首页 > 代码库 > Dubbo 与 ImmutableList冲突解决
Dubbo 与 ImmutableList冲突解决
在Java web实际开发中,常常用到微服务来进行架构分离,今天遇到一特奇怪的问题,Dububo 调用了接口三次,provider端而且没有抛出Exception。consumer却端抛出调用失败的异常。
异常如下:
org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver - Resolving exception from handler [public java.lang.String com.nh.erp.optool.controller.group.OpPlanWorkController.getStorePriceInitInfo(java.lang.String)]: com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findPlanStorePriceInfoVoByPlanId in the service com.nh.erp.productms.service.op.plan.IPlanService. Tried 3 times of the providers [192.168.34.26:8882] (1/1) from the registry 192.168.34.226:2181 on the consumer 192.168.34.26 using the dubbo version 2.8.4. Last error is: Failed to invoke remote method: findPlanStorePriceInfoVoByPlanId, provider: dubbo://192.168.34.26:8882/com.nh.erp.productms.service.op.plan.IPlanService?accepts=1000&anyhost=true&application=user-consumer-product&check=false&dubbo=2.8.4&generic=false&interface=com.nh.erp.productms.service.op.plan.IPlanService&methods=getPlanBasePriceInfo,getPlanAllAppointList,getPlanBaseInfo,updatePlanStrategyInfo,changePlanStatus,getPlanAllChannelList,getPlanStartCity,getPlanAllInfo,findPlanStorePriceInfoVoByPlanId,lockGroupLogic,getOrgCategoryAreaTabDataWithPlanNum,findProPlanReceivablesVoByPlanId,getAirTicketSupPolicyVoListByPlanId,getBugetInfoInView,getPlanHistoryList,updateChangeRecRemark,getPlanworkListVoList&organization=nh&owner=programmer&pid=756&revision=1.0-SNAPSHOT&serialization=dubbo&side=consumer&timeout=200000×tamp=1483753008842&validation=false, cause: java.lang.NullPointerException
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:40)
at com.google.common.collect.SingletonImmutableList$bc30.newInstance(SingletonImmutableList$bc30.java)
at com.alibaba.dubbo.common.serialize.support.dubbo.Builder$AbstractObjectBuilder.parseFrom(Builder.java:962)
at com.alibaba.dubbo.common.serialize.support.dubbo.GenericObjectInput.readObject(GenericObjectInput.java:93)
at com.alibaba.dubbo.common.serialize.support.dubbo.Builder$5.parseFrom(Builder.java:989)
at com.nh.erp.productms.model.DTO.op.plan.PlanStorePriceInfoVo$bc22.readObject(PlanStorePriceInfoVo$bc22.java)
at com.alibaba.dubbo.common.serialize.support.dubbo.Builder$AbstractObjectBuilder.parseFrom(Builder.java:964)
at com.alibaba.dubbo.common.serialize.support.dubbo.GenericObjectInput.readObject(GenericObjectInput.java:93)
at com.alibaba.dubbo.common.serialize.support.dubbo.Builder$5.parseFrom(Builder.java:989)
at com.nh.utils.Response$bc1.readObject(Response$bc1.java)
at com.alibaba.dubbo.common.serialize.support.dubbo.Builder$AbstractObjectBuilder.parseFrom(Builder.java:964)
at com.alibaba.dubbo.common.serialize.support.dubbo.GenericObjectInput.readObject(GenericObjectInput.java:93)
at com.alibaba.dubbo.common.serialize.support.dubbo.GenericObjectInput.readObject(GenericObjectInput.java:110)
at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:87)
at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:117)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:98)
at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:134)
at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:95)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46)
at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:134)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
注意到异常中有SingletonImmutableList后,把guava FluentIterable接口返回的接口再进行包一层,变成LinkedList,Dubbo却不再报错了,具体原因,可能跟ImmutableList的
实现有关。
Dubbo 与 ImmutableList冲突解决