[Java] java.lang.NoClassDefFoundError: Could not initialize class org.xnio.channels.Channels (JDK의 Bug)
31 Jul 2023java.lang.NoClassDefFoundError: Could not initialize class org.xnio.channels.Channels
ava.lang.NoClassDefFoundError: Could not initialize class org.xnio.channels.Channels
at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:618)
at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:486)
at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:575)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:351)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
처음엔 라이브러리의 의존성이 제대로 추가되어있지 않은줄 알고 뻘짓을 하며 헤멨었지만, Google 선생님의 힘을 빌어 찾아보니, JDK의 해당 마이너 버전에 버그가 있었다.
JDK issue report : https://bugs.openjdk.org/browse/JDK-8285445
jdk 1.8.0_332 버전 및 jdk 11.0.15 버전은 JDK 자체 버그로 java.lang.NoClassDefFoundError: Could not initialize class org.xnio.channels.Channels
관련 예외가 발생하므로, 이전 버전이나 이후 픽스된 버전을 추천한다.