一、异常描述
在调试Undertow的HelloWorldServer的时候运行把“ java.lang.NoClassDefFoundError: org/xnio/ChannelListener”、“ java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger”异常,详情见下方日志说明
Exception in thread "main" java.lang.NoClassDefFoundError: org/xnio/ChannelListener@b@ at test.HelloWorldServer.main(HelloWorldServer.java:15)@b@Caused by: java.lang.ClassNotFoundException: org.xnio.ChannelListener@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:372)@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:361)@b@ at java.security.AccessController.doPrivileged(Native Method)@b@ at java.net.URLClassLoader.findClass(URLClassLoader.java:360)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:424)@b@ at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:357)@b@ ... 1 more@b@ @b@ @b@Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger@b@ at java.lang.ClassLoader.defineClass1(Native Method)@b@ at java.lang.ClassLoader.defineClass(ClassLoader.java:760)@b@ at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)@b@ at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)@b@ at java.net.URLClassLoader.access$100(URLClassLoader.java:73)@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:367)@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:361)@b@ at java.security.AccessController.doPrivileged(Native Method)@b@ at java.net.URLClassLoader.findClass(URLClassLoader.java:360)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:424)@b@ at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:357)@b@ at org.xnio.Xnio.<clinit>(Xnio.java:95)@b@ at io.undertow.Undertow.start(Undertow.java:95)@b@ at test.HelloWorldServer.main(HelloWorldServer.java:24)@b@Caused by: java.lang.ClassNotFoundException: org.jboss.logging.BasicLogger@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:372)@b@ at java.net.URLClassLoader$1.run(URLClassLoader.java:361)@b@ at java.security.AccessController.doPrivileged(Native Method)@b@ at java.net.URLClassLoader.findClass(URLClassLoader.java:360)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:424)@b@ at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)@b@ at java.lang.ClassLoader.loadClass(ClassLoader.java:357)@b@ ... 15 more
二、解决方法
1.对于ChannelListener异常,直接xnio下载对应jar依赖包并加载的项目再执行(更多xnio-api版本下载)
2.对于BasicLogger异常,直接下载对于依赖包xnio-nio.jar