服务器:[http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service 错误处理请求 java.lang.NullPointerException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41690854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Server: [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service Error processing request java.lang.NullPointerException
提问by Java Basketball
My tomcat server always throws the following the errors(in the linux,Tomcat version is 8.5.4, using tail -f catalina.out):
我的tomcat服务器总是抛出以下错误(在linux中,Tomcat版本是8.5.4,使用tail -f catalina.out):
The first error:
第一个错误:
17-Jan-2017 10:39:24.982 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service Error processing request
java.lang.NullPointerException
at org.apache.catalina.connector.Request.parseCookies(Request.java:3047)
at org.apache.catalina.connector.Request.getServerCookies(Request.java:2098)
at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:707)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
17-Jan-2017 10:39:24.983 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
java.lang.NullPointerException
The second error:
第二个错误:
17-Jan-2017 11:08:33.696 SEVERE [http-nio-8080-exec-8] org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
java.lang.NullPointerException
17-Jan-2017 11:08:33.743 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service Error processing request
java.lang.NullPointerException
17-Jan-2017 11:08:33.743 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
java.lang.NullPointerException
17-Jan-2017 11:08:33.838 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service Error processing request
java.lang.NullPointerException
17-Jan-2017 11:08:33.838 SEVERE [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
java.lang.NullPointerException
The third error:
第三个错误:
17-Jan-2017 11:20:52.232 SEVERE [http-nio-8080-exec-3] org.apache.coyote.http11.Http11Processor.service Error processing request
java.lang.NullPointerException
at org.apache.tomcat.util.buf.MessageBytes.toChars(MessageBytes.java:257)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:641)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
The front end html always print the errors:
前端 html 总是打印错误:
Failed to load resource: the server responded with a status of 502 (Bad Gateway)
Backend server mainly use Spring, Jersey and the front end uses H5, AngularJS. Any idea, i will appreciate!
后端服务器主要使用Spring、Jersey,前端使用H5、AngularJS。任何想法,我将不胜感激!
回答by deepakborania
I am not an expert in this area but it seems like some sort of problem with request or cookies encoding. Might also be a tomcat bug.
我不是这方面的专家,但请求或 cookie 编码似乎存在某种问题。也可能是一个tomcat错误。
For the first error can you try Rfc6265CookieProcessor.Please check thisfor details.
对于第一个错误,您可以尝试 Rfc6265CookieProcessor 。有关详细信息,请检查此内容。
<Context>
....
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" />
....
</Context>
回答by Shailesh
This type of error occur when some problem with your tomcat version. Without a test case to reproduce the problem there is little the Tomcat developers can do. It looks like multiple threads are acting on the same socket at the same time. What I can't tell is if that is intentional, the result of a Tomcat bug or something the frameworks/app is doing.
当您的 tomcat 版本出现问题时会发生此类错误。如果没有测试用例来重现问题,Tomcat 开发人员几乎无能为力。看起来多个线程同时作用于同一个套接字。我不知道这是故意的,是 Tomcat 错误的结果还是框架/应用程序正在做的事情。
I don't have much knowledge of this but i have fixed my issue after ready this.
Other solution:-
其他解决方案:-
This was also asked before here. It possible that which version of tomcat are you using?
这也是之前在这里问过的。可能您使用的是哪个版本的tomcat?
For this exception
对于这个例外
SEVERE: An exception or error occurred in the container during the request processing
java.lang.NullPointerException
you need to read this stack overflow answer.
您需要阅读此堆栈溢出答案。
The 502 Bad Gateway error is an HTTP status code that means that one server on the internet received an invalid response from another server. For that you need to read this tutorial.
502 Bad Gateway 错误是一个 HTTP 状态代码,这意味着 Internet 上的一台服务器收到了来自另一台服务器的无效响应。为此,您需要阅读本教程。
回答by TRC4
try to replace http-nio-8080 with http://localhost:8080or ip:8080
尝试用http://localhost:8080或 ip:8080替换 http-nio- 8080