Mina framework stepped pit Record

1. org.apache.mina.filter.codec.ProtocolDecoderException: java.nio.BufferOverflowException not receive data error

One reason:

Buffer too small

modify:

connection.getSessionConfig().setReadBufferSize(1024*1024);//发送缓冲区1M

connection.getSessionConfig().setReceiveBufferSize(1024*1024);//接收缓冲区1M

If the error remains after modification:

Check the filter:

chain.addLast("a", new LoggingFilter());
chain.addLast("b", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));

Filter client and server try to keep up, and can only have one filter.

Published 33 original articles · won praise 1 · views 4166

Guess you like

Origin blog.csdn.net/qq_39827677/article/details/103734475