jfinal3.5 undertow 报错

maven jar包都是正常的,我在台式机下配置同样环境正常,jdk版本也是和台式机一样

Starting Undertow Server localhost:80

Starting Complete in 7.8 seconds. Welcome To The JFinal World (^_^)



JFinal-3.5 action report -------- 2019-01-24 21:51:05 --------------------------

Url         : GET /

Controller  : cn.jbolt.index.IndexController.(IndexController.java:1)

Method      : index

Interceptor : com.jfinal.ext.interceptor.SessionInViewInterceptor.(SessionInViewInterceptor.java:1)

--------------------------------------------------------------------------------


2019-01-24 21:51:05

[ERROR]-[Thread: XNIO-1 task-1]-[io.undertow.servlet.api.LoggingExceptionHandler.handleThrowable()]: UT005023: Exception handling request to /

java.lang.NoClassDefFoundError: Could not initialize class org.xnio.channels.Channels

at io.undertow.servlet.spec.ServletOutputStreamImpl.flushInternal(ServletOutputStreamImpl.java:494)

at io.undertow.servlet.spec.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:476)

at com.jfinal.template.io.ByteWriter.close(ByteWriter.java:51)

at com.jfinal.template.Template.render(Template.java:61)

at com.jfinal.render.TemplateRender.render(TemplateRender.java:61)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:106)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:86)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)

at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)

at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

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:360)

at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)


2019-01-24 21:51:05

[ERROR]-[Thread: XNIO-1 task-1]-[io.undertow.server.Connectors.executeRootHandler()]: UT005071: Undertow request failed HttpServerExchange{ GET / request {Connection=[keep-alive], Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8], Accept-Language=[zh-CN,zh;q=0.9], Accept-Encoding=[gzip, deflate, br], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36], Upgrade-Insecure-Requests=[1], Host=[localhost]} response {Connection=[keep-alive], Server=[JFinal], Content-Type=[text/html;charset=UTF-8], Content-Length=[0], Date=[Thu, 24 Jan 2019 13:51:05 GMT]}}

java.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:346)

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:360)

at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)


评论区

JFinal

2019-01-24 22:00

jetty 相关所有依赖要删干净

zhangke

2019-01-24 22:06

@JFinal 删除干净了。。。这个问题困扰了好长时间。 同样的环境在台式机就没问题,在笔记本上只要跑起来访问主页就会出现这个问题。

JFinal

2019-01-24 22:41

@zhangke 应该是 jar 包被损坏了,在本地 maven 库中删掉 org/xnio/ 这个子目录下面的目录,让 maven 库重新下载 jar 包

zhangke

2019-01-24 22:57

@JFinal 我把整个repository包都删了,然后重新下载还是不行。。我在google上发现了类似问题
https://groups.google.com/a/ortussolutions.com/forum/#!topic/commandbox/TZb2mbS5Dlg

JFinal

2019-01-24 23:07

@zhangke 如果不是包有损坏,那就是有不同版本的多个 jar 出现了冲突,检查出问题启动的 class path 下是否有多个 jar 包有冲突

zhangke

2019-01-24 23:09

@JFinal 好的,我在检查一下

JFinal

2019-01-24 23:18

@zhangke 用 mvn clean package 打好包,然后检查 lib 目录下面所有 jar 包,看有没有两个 jar 包中都存在 org.xnio.channels.Channels 这样的类文件

zhangke

2019-01-24 23:26

@JFinal 好的,我明天再试试,谢谢您。

zhangke

2019-01-25 15:49

@JFinal 问题找到了,问题出在xnio包里底层代码执行new FileOutputStream("NUL:").getChannel(); 的时候报错,最后检查发现是我的系统null.sys文件异常导致,重新下载null.sys文件覆盖然后启动windows服务后就好了

JFinal

2019-01-25 16:16

@zhangke 这个原因引发问题,还是头一次见,解决就好

zhuzhuAAA

2019-03-15 11:13

@zhangke 你是怎么发现问题 排错的啊 我的问题好像和你的一样 但是我不知道哪里错了

zhangke

2019-03-26 16:38

@zhuzhuAAA 之前去google一段时间,查到类似的问题,然后最终跟踪到就是系统的问题造成的。

JFinal

2019-06-06 12:34

引用另一位同学 @tydl 在另一个贴子中的回复:

按此方式解决!谢谢~ 注意找网上下载null.sys注意系统版本64 32位,开始找了一个不行,估计是32位的。

附上WIN64的 null.sys地址:链接:https://pan.baidu.com/s/1UtcZizm-iFcVk4OKrnFJVg 密码:1q4d 回复

确定是否正常的命令是:C:\Users\Administrator>sc start null

fmpoffice

2022-04-29 16:03

不知道什么原因导致出现这个问题

lyh061619

2022-06-22 13:08

跟jdk版本有关,新版本jdk发布undertow org.jboss.xino组件代码没有及时适配,在一些特定条件下会出现编译时可以加载到类,运行时不可以加载到类,这时候就会出现java.lang.NoClassDefFoundError异常。

nur

2022-10-30 18:34

@lyh061619 那要怎么解决。。我也遇到了同样的问题(我是小白)

热门反馈

扫码入社