源代碼運行報錯 java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup
java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: io.netty.channel.EventLoopGroup
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"?
如何解決啊?
2018-06-26
請先將本地maven倉庫的netty包含的jar或者是工程中的lib下的jar刪除,重新下載一個完整的jar替換試試,估計是jar的完整性有問題
或者是jar的版本有問題,比如netty4 和netty5的SimpleChannelInboundHandler 方法會存在細微差別,
netty4? 的channelRead0 對應 netty5 的 messageReceived方法,處理結(jié)果一致,但是方法名變了
2018-03-12
包都引進去了,還是報這個錯,我用的是idea編輯器