错误信息如下:
代码语言:javascript复制// ::: CST] main ERROR transport.AbstractCodec: Data length too large: , max payload: , channel: NettyChannel [channel=[id: 0x5c465e9f, /192.168.140.29: => /192.168.140.29:]]
java.io.IOException: Data length too large: , max payload: , channel: NettyChannel [channel=[id: 0x5c465e9f, /192.168.140.29: => /192.168.140.29:]]
at com.alibaba.dubbo.remoting.transport.AbstractCodec.checkPayload(AbstractCodec.java:)
at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:)
at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:)
at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.doEncode(OneToOneEncoder.java:)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:)
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:)
at org.jboss.netty.channel.SimpleChannelHandler.writeRequested(SimpleChannelHandler.java:)
at com.alibaba.dubbo.remoting.transport.netty.NettyHandler.writeRequested(NettyHandler.java:)
at org.jboss.netty.channel.SimpleChannelHandler.handleDownstream(SimpleChannelHandler.java:)
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:)
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:)
at org.jboss.netty.channel.Channels.write(Channels.java:)
at org.jboss.netty.channel.Channels.write(Channels.java:)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:)
at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:)
at com.alibaba.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:)
at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request(HeaderExchangeChannel.java:)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient.request(HeaderExchangeClient.java:)
at com.alibaba.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.request(ReferenceCountExchangeClient.java:)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:)
at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:)
at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$.invoke(ProtocolFilterWrapper.java:)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$.invoke(ProtocolFilterWrapper.java:)
at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$.invoke(ProtocolFilterWrapper.java:)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:)
at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:)
at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:)
at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:)
at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:)
at com.alibaba.dubbo.common.bytecode.proxy0.getData(proxy0.java)
at com.dubbo.demo.DemoService.Consumer.main(Consumer.java:)
调大 payload 即可解决相关问题
解决方案1: 怎么解决,在服务提供提供者, 添加
代码语言:javascript复制<dubbo:protocol name="dubbo" port="20880" payload="39889058"/>
39889058 > 39889057 可以发现是生效的,不再爆出异常了 解决方案2: dubbo.properties中添加一行 dubbo.protocol.dubbo.payload=39889058
但是要强调的是,一般是不建议使用这种方式。
Dubbo 缺省协议采用单一长连接和 NIO 异步通讯,适合于小数据量大并发的服务调用,以及服务消费者机器数远大于服务提供者机器数的情况。Dubbo缺省协议不适合传送大数据量的服务,比如传文件,传视频等,除非请求量很低。