Failed to initialize a channel. Closing: [id: 0x1bd7c1d4, /0:0:0:0:0:0:0:1:56640 => /0:0:0:0:0:0:0:1:8888]

来源:5-6 WebSocket启动类的实现

慕田峪0847372

2018-06-19 13:53


六月 19, 2018 1:49:25 下午 io.netty.channel.ChannelInitializer channelRegistered
警告: Failed to initialize a channel. Closing: [id: 0x1bd7c1d4, /0:0:0:0:0:0:0:1:56640 => /0:0:0:0:0:0:0:1:8888]
java.lang.IllegalArgumentException: Duplicate handler name: aggregator
 at io.netty.channel.DefaultChannelPipeline.checkDuplicateName(DefaultChannelPipeline.java:949)
 at io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:141)
 at io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:130)
 at xzx.MyWebSocketChannelHandler.initChannel(MyWebSocketChannelHandler.java:14)
 at xzx.MyWebSocketChannelHandler.initChannel(MyWebSocketChannelHandler.java:10)
 at io.netty.channel.ChannelInitializer.channelRegistered(ChannelInitializer.java:69)
 at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelRegisteredNow(ChannelHandlerInvokerUtil.java:30)
 at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRegistered(DefaultChannelHandlerInvoker.java:49)
 at io.netty.channel.DefaultChannelHandlerContext.fireChannelRegistered(DefaultChannelHandlerContext.java:285)
 at io.netty.channel.ChannelInitializer.channelRegistered(ChannelInitializer.java:71)
 at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelRegisteredNow(ChannelHandlerInvokerUtil.java:30)
 at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRegistered(DefaultChannelHandlerInvoker.java:49)
 at io.netty.channel.DefaultChannelHandlerContext.fireChannelRegistered(DefaultChannelHandlerContext.java:285)
 at io.netty.channel.DefaultChannelPipeline.fireChannelRegistered(DefaultChannelPipeline.java:801)
 at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:427)
 at io.netty.channel.AbstractChannel$AbstractUnsafe.access$100(AbstractChannel.java:369)
 at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:403)
 at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:318)
 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
 at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:794)
 at java.lang.Thread.run(Thread.java:745)


写回答 关注

4回答

  • 慕设计6411780
    2019-08-22 13:46:29

    pipeline.addLast("handler", new MyWebSocketHandler()); 之前写成pipeline.addLast("handler", new MyWebSocketChannelHandler()); 了,结果报的重复的问题。改了就好了

  • 天道酬勤_xsj
    2019-07-24 02:09:38

    我也是这个问题,换了

    5.0.0.Alpha2

    就报这个错误,不知道该怎么解决

  • 黎明的烬
    2018-07-02 15:41:06

    你好,请问找到原因了吗?

  • 花落无声0718
    2018-06-19 14:21:13

    aggregator 这个 handler 你加了2次吧

Netty入门之WebSocket初体验

由浅入深了解Java高性能NIO通信首选框架——Netty

29324 学习 · 63 问题

查看课程

相似问题