Exception "DefaultHttpChunk cannot be cast to HttpRequest"

Neio pinghuican at gmail.com
Tue Mar 17 17:53:49 EDT 2009


Hello Trustin,

For this BETA1, I have some problem.

I sendin a NOT-chunked message with body about 20K to my netty server, I got
the error "DefaultHttpChunk cannot be cast to
org.jboss.netty.handler.codec.http.HttpRequest".

While debugging a little bit, I noticed that after I sent-in this message, I
got multiple times of messageReceived() calls. For one message, am I
supposed to get multiple messageReceived() call?

The first messageReceived() call, the cast in line 313 is fine, I saw the
content-length of that message is 0. At the 2nd messageReceived() call, it
breaks out.

I didn't have this problem with ALPHA4. The only change is ALPHA4 to BETA,
and no code change for my server implementation.

====================
The line 313 is:
313:                    HttpRequest req = (HttpRequest) event.getMessage();
Exception:
java.lang.ClassCastException:
org.jboss.netty.handler.codec.http.DefaultHttpChunk cannot be cast to
org.jboss.netty.handler.codec.http.HttpRequest
        at acme.test.http.is.HttpHandler$1.doInContext(HttpHandler.java:313)
        at
acme.test.runtime.message.impl.MessageContextImpl.doInUserContext(MessageContextImpl.java:92)
        at
acme.test.runtime.message.impl.MessageContextImpl.doInContext(MessageContextImpl.java:159)
        at
acme.test.http.is.HttpHandler.messageReceived(HttpHandler.java:308)
        at
org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:105)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:567)
        at
org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:802)
        at
org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:385)
        at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.fireMessageReceived(ReplayingDecoder.java:430)
        at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:410)
        at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:354)
        at
org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:105)
        at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.handleUpstream(ReplayingDecoder.java:317)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:567)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:562)
        at
org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:342)
        at
org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:329)
        at
org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:296)
        at
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:251)
        at
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:173)
        at
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:72)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
        at java.lang.Thread.run(Unknown Source)

-- 
View this message in context: http://n2.nabble.com/Exception-%22DefaultHttpChunk-cannot-be-cast-to-HttpRequest%22-tp2494094p2494094.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list