dubbox+thrift ClassCastException

发布于 2021-12-02 22:05:39 字数 4843 浏览 822 评论 1

我使用的是dubbox 2.8.4+thrift,在某些情况下会报类型转换异常,报这个异常之后只能重启才能正常,在某些情况后又会抛异常,以下是异常堆栈。

[DUBBO] ChannelEventRunnable handle RECEIVED operation error, channel is NettyChannel [channel=[id: 0xbebe1b7d, /10.162.90.23:11451 => /10.51.38.65:30001]], message is Request [id=18, version=null, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=getAreaCountry, parameterTypes=[int, int], arguments=[1, 3], attachments={interface=com.yuntongxun.yoyo.service.AreaIconService$Iface}]], dubbo version: 2.0.0.1, current host: 127.0.0.1
com.alibaba.dubbo.remoting.RemotingException: Failed to send message Response [id=18, version=null, status=20, event=false, error=null, result=RpcResult [result=[AreaIcon(ID:110, area_name:泰国, area_code:Thailand, pic_url:/area/chaoshi_taiguo.png, update_time:2017-04-28 16:46:26.0, home_pic_url:/area/taiguo_mudidi.jpg, parentId:0, area_type:1), AreaIcon(ID:109, area_name:日本, area_code:riben, pic_url:/area/chaoshi_riben.png, update_time:2017-04-28 16:47:26.0, home_pic_url:/area/riben_mudidi.jpg, parentId:0, area_type:1), AreaIcon(ID:101, area_name:香港, area_code:hongkong, pic_url:/area/chaoshi_xianggang.png, update_time:2017-04-28 15:25:57.0, home_pic_url:/area/xianggang_mudidi.jpg, parentId:0, area_type:1), AreaIcon(ID:104, area_name:韩国, area_code:hanguo, pic_url:/area/chaoshi_hanguo.png, update_time:2017-04-28 14:00:35.0, home_pic_url:/area/hanguo_mudidi.jpg, parentId:0, area_type:1)], exception=null]] to /10.162.90.23:11451, cause: com.yuntongxun.yoyo.service.model.area.AreaIcon cannot be cast to com.yuntongxun.yoyo.service.model.activity.Activity
        at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:108) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:51) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:171) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [yoyo-2.0.0.1.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [?:1.7.0_71]
Caused by: java.lang.ClassCastException: com.yuntongxun.yoyo.service.model.area.AreaIcon cannot be cast to com.yuntongxun.yoyo.service.model.activity.Activity
        at com.yuntongxun.yoyo.service.ActivityService$getActivityList_result$getActivityList_resultStandardScheme.write(ActivityService.java:975) ~[yoyo-2.0.0.1.jar:?]
        at com.yuntongxun.yoyo.service.ActivityService$getActivityList_result$getActivityList_resultStandardScheme.write(ActivityService.java:1) ~[yoyo-2.0.0.1.jar:?]
        at com.yuntongxun.yoyo.service.ActivityService$getActivityList_result.write(ActivityService.java:879) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.rpc.protocol.thrift.ThriftCodec.encodeResponse(ThriftCodec.java:672) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.rpc.protocol.thrift.ThriftCodec.encode(ThriftCodec.java:105) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:81) ~[yoyo-2.0.0.1.jar:?]
        at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.doEncode(OneToOneEncoder.java:66) ~[yoyo-2.0.0.1.jar:?]
        at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:59) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.netty.NettyHandler.writeRequested(NettyHandler.java:99) ~[yoyo-2.0.0.1.jar:?]
        at org.jboss.netty.channel.Channels.write(Channels.java:704) ~[yoyo-2.0.0.1.jar:?]
        at org.jboss.netty.channel.Channels.write(Channels.java:671) ~[yoyo-2.0.0.1.jar:?]
        at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) ~[yoyo-2.0.0.1.jar:?]
        at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:98) ~[yoyo-2.0.0.1.jar:?]
        ... 7 more

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虐人心 2021-12-03 18:09:53

顶!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文