m0_74763306 2023-03-29 21:42 采纳率: 50%
浏览 22
已结题

Netty调用service报错

在Netty处理器里面channelRead方法service查询数据库报错

io.netty.channel.DefaultChannelPipeline : An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.

  • 写回答

2条回答 默认 最新

  • 远控源码 2023-03-30 09:44
    关注

    解决方法:

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
            super.exceptionCaught(ctx, cause);
            Channel channel = ctx.channel();
            //……
            if(channel.isActive())ctx.close();
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
    1人已打赏
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月8日
  • 已采纳回答 3月31日
  • 创建了问题 3月29日