错误提示:2018-11-07 14:52:37.350 ERROR 4004 — [ XNIO-1 task-5] io.undertow.request : UT005022: Exception generating error page /error
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:82) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) ~[undertow-core-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) ~[undertow-core-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:229) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:172) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:391) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:318) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:263) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) ~[undertow-core-1.0.1.Final.jar:1.0.1.Final]
at io.undertow.server.HttpServerExchange 1. r u n ( H t t p S e r v e r E x c h a n g e . j a v a : 687 ) [ u n d e r t o w − c o r e − 1.0.1. F i n a l . j a r : 1.0.1. F i n a l ] a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1142 ) [ n a : 1.8. 0 1 21 ] a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r 1.run(HttpServerExchange.java:687) [undertow-core-1.0.1.Final.jar:1.0.1.Final] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121] at java.util.concurrent.ThreadPoolExecutor 1.run(HttpServerExchange.java:687)[undertow−core−1.0.1.Final.jar:1.0.1.Final]atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0121]atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
Caused by: java.lang.NullPointerException: null
at java.util.ArrayList.(ArrayList.java:177) ~[na:1.8.0_121]
at io.undertow.servlet.spec.HttpServletResponseImpl.getHeaders(HttpServletResponseImpl.java:248) ~[undertow-servlet-1.0.1.Final.jar:1.0.1.Final]
at org.springframework.http.server.ServletServerHttpResponse S e r v l e t R e s p o n s e H t t p H e a d e r s . g e t ( S e r v l e t S e r v e r H t t p R e s p o n s e . j a v a : 161 ) [ s p r i n g − w e b − 4.3.8. R E L E A S E . j a r : 4.3.8. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . h t t p . s e r v e r . S e r v l e t S e r v e r H t t p R e s p o n s e ServletResponseHttpHeaders.get(ServletServerHttpResponse.java:161) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE] at org.springframework.http.server.ServletServerHttpResponse ServletResponseHttpHeaders.get(ServletServerHttpResponse.java:161) [spring−web−4.3.8.RELEASE.jar:4.3.8.RELEASE]atorg.springframework.http.server.ServletServerHttpResponseServletResponseHttpHeaders.containsKey(ServletServerHttpResponse.java:143) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:175) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:113) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
… 23 common frames omitted
问题参考:
https://stackoverflow.com/questions/34354481/org-springframework-web-util-nestedservletexception-request-processing-failed
https://github.com/ldojo/wf-8.1.0-undertow-1.0.15-patch
这个是io.undertow.servlet包的一个bug,在1.0.1和1.0.15都遇到了,具体影响有哪些版本不清楚。
解决办法:升级io.undertow.servlet包
io.undertow
undertow-servlet
2.0.15.Final