mina2开发,对象序列化传输,运行一段时间后出现ProtocolDecoderException
EOFException错误
很奇怪的问题,目前就一个客户端在做测试,两端都是JAVA,对象序列化传输,通信一开始没问题,运行一段时间后:
org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.Buffer
DataException:
java.io.UTFDataFormatException (Hexdump: 00 00 73 72 01 00 13 6A 61 76 61 2E 75 74 69 6C 2E 41 72 72 61 79 4C 69 73 74 78 70 00 00 00 07 77 04 00 00 00 0A 73 71 00 7E 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 C9 00 00 00 00 00 00 00 6D 00 00 00 B8 00 00 00 00 00 00 00 00 00 00 00 C8 00 00 00 00 00 00 00 00 70 70 74 00 36 68 74 74 70 3A 2F 2F 6D 2E 62 61 69 64 75 2E 63 6F 6D 2F 73 74 61 74 69 63 2F 69 6E 64 65 78 2F 66 61 76 69 63 6F 6E 2D 35 37 2E 70 6E 67 3F 74 6A 3D 69 63 6F 6E 73 71 00 7E 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 03 A1 00 00 00 00 00 00 00 00 00 00 00 A7 00 00 00 00 00 00 00 10 00 00 00 C8 00 00 00 00 00 00 00 00 70 70 74 00 25 68 74 74 70 3A 2F 2F 6D 2E 62 61 69 64 75 2E 63 6F 6D 2F 73 74 61 74 69 63 2F 69 6E 64 65 78 2F 69 2E 67 69 66 73 71 00 7E 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 98 00 00 00 00 00 00 00 00 00 00 00 A6 00 00 00 00 00 00 00 00 00 00 00 C8 00 00 00 00 00 00 00 00 70 70 74 00 24 68 74 74 70 3A 2F 2F 6D 2E 62 61 69 64 75 2E 63 6F 6D 2F 73 74 61 74 69 63 2F 68 62 2F 68 6F 74 2E 67 69 66 73 71 00 7E 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 0B E3 00 00 00 00 00 00 00 00 00 00 00 A8 00 00 00 00 00 00 00 00 00 00 00 C8 00 00 00 00 00 00 00 00 70 70 74 00 26 68 74 74 70 3A 2F 2F 6D 2E 62 61 69 64 75 2E 63 6F 6D 2F 73 74 61 74 69 63 2F 69 6E 64 65 78 2F 70 31 2E 70 6E 67 73 71 00 7E 00)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:251)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:177)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:75)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
求高手指点。。
------解决方案--------------------
我之前也遇到了这个问题~这个应该是mina反序列化的时候由于对象过大而反序列化失败~你可以尝试调用 ObjectSerializationCodecFactory 的 setDecoderMaxObjectSize 方法来修改反序列化时对象的最大大小