Exception "DefaultHttpChunk cannot be cast to HttpRequest"

huican ping pinghuican at gmail.com
Wed Mar 18 10:34:04 EDT 2009


Hello Trustin,

For the issue:
>> 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?

Do you think it is right for having multiple messageReceived() for one
input message?
Thanks


On Tue, Mar 17, 2009 at 11:56 PM, Trustin Lee <tlee at redhat.com> wrote:
> Please check the release announcement.  The behavior of HTTP codec has
> been channged.
>
> — Trustin Lee, http://gleamynode.net/
>
> On Wed, Mar 18, 2009 at 6:53 AM, Neio <pinghuican at gmail.com> wrote:
>>
>> 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.
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>




More information about the netty-users mailing list