Java Tomcat 8.5.45在启动后抛出大量NullPointerException-s,但仍能正常工作

Java Tomcat 8.5.45在启动后抛出大量NullPointerException-s,但仍能正常工作,java,tomcat,Java,Tomcat,最近,我们将ApacheTomcat服务器从8.5.32更新为8.5.45。我们注意到,Tomcat在启动后会向catalina.out发送NullPointerException-s音,但是,连接器工作正常,它处于打开状态并正在侦听: 10-Oct-2019 10:48:31.210 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 13452 ms 10-Oct-2019 10:48:31.247

最近,我们将ApacheTomcat服务器从8.5.32更新为8.5.45。我们注意到,Tomcat在启动后会向catalina.out发送NullPointerException-s音,但是,连接器工作正常,它处于打开状态并正在侦听:

10-Oct-2019 10:48:31.210 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 13452 ms
10-Oct-2019 10:48:31.247 SEVERE [https-jsse-nio-8443-exec-2] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading request, ignored
        java.lang.NullPointerException
                at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.getSslSupport(NioEndpoint.java:1415)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1504)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)
10-Oct-2019 10:48:31.247 SEVERE [https-jsse-nio-8443-exec-3] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading request, ignored
        java.lang.NullPointerException
                at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.getSslSupport(NioEndpoint.java:1415)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1504)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)
10-Oct-2019 10:48:31.247 SEVERE [https-jsse-nio-8443-exec-3] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
        java.lang.NullPointerException
                at org.apache.coyote.http11.Http11InputBuffer.recycle(Http11InputBuffer.java:282)
                at org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1714)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:993)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:961)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1504)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)
10-Oct-2019 10:48:31.247 SEVERE [https-jsse-nio-8443-exec-4] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading request, ignored
        java.lang.NullPointerException
                at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.getSslSupport(NioEndpoint.java:1415)
                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1504)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)

我们查过论坛等等。。。找到将
协议更改为
org.apache.coyote.http11.Http11NioProtocol
的建议,但没有帮助。 连接器的配置如下所示:

<Connector port="8443" minProcessors="5" maxProcessors="75"
      protocol="org.apache.coyote.http11.Http11NioProtocol"
      SSLEnabled="true" server=" "
      enableLookups="false" disableUploadTimeout="true"
      acceptCount="100" debug="0" scheme="https" secure="true"
      keystoreFile="<keystore>"
      keystorePass="<password>"
      truststoreFile="<truststore>"
      truststorePass="<password>"
      URIEncoding="UTF-8"
      clientAuth="true" xpoweredBy="false" 
      connectionTimeout="60000" maxHttpHeaderSize="8192" 
      allowTrace="false"
      sslEnabledProtocols="TLSv1.2"
      SSLHonorCipherOrder="on"
      useServerCipherSuitesOrder="true"
      ciphers="SSL_DHE_DSS_WITH_AES_128_CBC_SHA..."/>

Ubuntu 20.04上使用Tomcat 8.5进行安装时,我遇到了类似的问题

这是我的连接器

Connector protocol="org.apache.coyote.http11.Http11Protocol"
          port="8443" maxThreads="200" scheme="https"
          secure="true" SSLEnabled="true"
          keystoreFile="/usr/share/tomcat.keystore"
          keystorePass="GODMYROCK"
          clientAuth="false" sslProtocol="TLS"
          URIEncoding="UTF-8"
          compression="force"
          compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"/>
但每次启动应用程序时,它都会在日志中抛出以下错误:

严重[https-jsse-nio-8443-exec-3]org.apache.tomcat.util.net.niodempoint$SocketProcessor.doRun java.lang.NullPointerException

以下是我如何修复它的方法

Connector protocol="org.apache.coyote.http11.Http11Protocol"
          port="8443" maxThreads="200" scheme="https"
          secure="true" SSLEnabled="true"
          keystoreFile="/usr/share/tomcat.keystore"
          keystorePass="GODMYROCK"
          clientAuth="false" sslProtocol="TLS"
          URIEncoding="UTF-8"
          compression="force"
          compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"/>
我只是将连接器协议从
org.apache.coyote.http11.Http11Protocol
更改为
org.apache.coyote.http11.Http11NioProtocol
。因此,我的连接器此后看起来是这样的:

Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
          port="8443" maxThreads="200" scheme="https"
          secure="true" SSLEnabled="true"
          keystoreFile="/usr/share/tomcat.keystore"
          keystorePass="GODMYROCK"
          clientAuth="false" sslProtocol="TLS"
          URIEncoding="UTF-8"
          compression="force"
          compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"/>
就这些


我希望这有帮助

不确定,但您的
元素现在可能需要一个子元素
?非常感谢您的详细回答。我的问题与法理学相似。解决方案只是将协议更改为:protocol=“org.apache.coyote.http11.Http11NioProtocol”