Search code examples
javanionetty

Netty large POJO transfer error: TooLongFrameException


I have a netty pipeline such as:

            return Channels.pipeline(
                    new ObjectEncoder(),
                    new ObjectDecoder(),
                    new MyCustomCommandServerHandler());

For both the client and server where:

MyCustomCommandServerHandler extends SimpleChannelUpstreamHandler

The error I'm getting is that the POJO I'm trying to send back from the server to the client is too large and results in the following error:

org.jboss.netty.handler.codec.frame.TooLongFrameException: Adjusted frame length exceeds 1048576: 1816357 - discarded

How do I adjust the ObjectEncoder/Decoder to take larger sized POJO objects?


Solution

  • You can pass it via the constructor. Just checkout the javadocs.