服务器:[http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service错误处理请求java.lang.NullPointerException

时间:2017-01-17 07:03:49

标签: java html5 web-services server tomcat8

我的tomcat服务器总是抛出以下错误(在linux中,Tomcat版本是8.5.4,使用tail -f catalina.out):

第一个错误:

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

第二个错误:

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

第三个错误:

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)

前端html始终打印错误:

Failed to load resource: the server responded with a status of 502 (Bad Gateway)

后端服务器主要使用Spring,Jersey和前端使用H5,AngularJS。任何想法,我将不胜感激!

4 个答案:

答案 0 :(得分:0)

我不是这方面的专家,但似乎是请求或cookie编码的某种问题。可能也是一个tomcat bug。

对于第一个错误,您可以尝试Rfc6265CookieProcessor。请检查this以获取详细信息。

final DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();

答案 1 :(得分:0)

当您的tomcat版本出现问题时,会发生此类错误。如果没有测试用例来重现问题,Tomcat开发人员就无法做到。看起来多个线程同时作用于同一个套接字。我能说的是,这是故意的,是Tomcat错误的结果还是框架/应用程序正在做的事情。

我对此并不了解,但我已修复了我的问题after ready this.

  

其他解决方案: -

这也是asked before here。您可能使用的是哪个版本的tomcat?

对于此例外

convertPoint:fromView:

您需要read this stack overflow answer.

502 Bad Gateway错误是HTTP状态代码,表示Internet上的一台服务器收到另一台服务器的无效响应。 为此,您需要read this tutorial.

答案 2 :(得分:0)

尝试用http://localhost:8080或ip:8080

替换http-nio-8080

答案 3 :(得分:0)

这是tomcat的错误,此错误是8.5.x及更高版本中的重构引入的。您可以搜索tomcat错误列表https://bz.apache.org/bugzilla/show_bug.cgi?id=60918

您可以通过升级tomcat版本或修改server.xml来解决问题 设置useSendfile =“ false”

<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" maxHttpHeaderSize="16384" maxThreads="2000" connectionTimeout="60000" disableUploadTimeout="true" redirectPort="8443" useSendfile="false"/>