报错

java.lang.NoClassDefFoundError: io/netty/channel/AbstractChannel$AbstractUnsafe$8
at io.netty.channel.AbstractChannel$AbstractUnsafe.deregister(AbstractChannel.java:807)
at io.netty.channel.AbstractChannel$AbstractUnsafe.fireChannelInactiveAndDeregister(AbstractChannel.java:767)
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:750)
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:605)
at io.netty.channel.nio.NioEventLoop.closeAll(NioEventLoop.java:745)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:524)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: io.netty.channel.AbstractChannel$AbstractUnsafe$8
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 common frames omitted
2019-12-16 16:18:39.632 default [nioEventLoopGroup-5-1] ERROR i.n.u.c.D.rejectedExecution - Failed to submit a listener notification task. Event loop shut down?
java.lang.NoClassDefFoundError: io/netty/util/concurrent/GlobalEventExecutor$2
at io.netty.util.concurrent.GlobalEventExecutor.startThread(GlobalEventExecutor.java:227)
at io.netty.util.concurrent.GlobalEventExecutor.execute(GlobalEventExecutor.java:215)
at io.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:764)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:421)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:538)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:527)
at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:90)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:963)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: io.netty.util.concurrent.GlobalEventExecutor$2
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11

问题在于maven中netty的版本,

笔者之前强制指定netty的版本

netty-websocket-spring-boot-starter关闭报错 io/netty/channel/AbstractChannel$Abstrac_.net

 

 

 后来把版本删除了,

依赖包如下:

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<!--<version>4.1.37.Final</version>-->
</dependency>

不再报错

打开jar文件确认如下(之前导入的依赖是4.1.37版本的netty):

netty-websocket-spring-boot-starter关闭报错 io/netty/channel/AbstractChannel$Abstrac_sed_02