Data length too large: 10710120, max payload: 8388608, channel: NettyChannel [channel=[id: 0x09396776, /10.195.2.51:48887 => /10.195.2.21:20881]]
1、报错信息
cause: java.io.IOException: Data length too large: 10710120, max payload: 8388608, channel: NettyChannel [channel=[id: 0x09396776, /10.195.2.51:48887 => /10.195.2.21:20881]] java.io.IOException: Data length too large: 10710120, max payload: 8388608, channel: NettyChannel [channel=[id: 0x09396776, /10.195.2.51:48887 => /10.195.2.21:20881]] at com.alibaba.dubbo.remoting.transport.AbstractCodec.checkPayload(AbstractCodec.java:49) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeResponse(ExchangeCodec.java:285) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:77) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:39) at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:81)
2、解决方案
消费层向提供层传输大数据容量的对象时,会受到Dubbo的限制,报类似如以上的异常
解决方案如下,有两种
第一种方案
修改提供方的dubbo配置,
在dubbo.properties 中增加如下
dubbo.protocol.dubbo.payload=11557050(默认为8M,即8388608)
第二种方案
再dubbo-provider.xml文件配置
<dubbo:provider id="payload" payload="11557050"/>