如何解决“ Http11NioProtocol:错误读取请求,被忽略”

当在具有SSL的Azure Kubernetes服务上运行时,我的spring-boot应用程序在tomcat服务器中的NPE启动后失败。

首先,什么工作成功:我有一个使用Spring Initializr创建的最小的Spring-boot应用程序:

  • 摇篮项目
  • Java 11
  • Spring Boot 2.1.8
  • 唯一的依赖:Spring Web

我想将其与蔚蓝云上的kubernetes集群一起使用。为此,我有一个Azure

Kubernetes服务(AKS)。我使用臂架构建docker镜像。到目前为止,一切正常。我可以将docker映像部署到azure

docker注册表,启动kubernetes集群(具有1个节点),并在调用“ http:// public-ip :8443 / hello” 后得到“

hello world ”。我使用端口8443,但使用正常的http来确保此端口不是我的问题的根源。

我希望我的应用程序支持HTTPS,因此我使用keytool制作了一个自签名证书。这在localhost上工作正常。它也可以在本地主机上运行的minikube内部运行。但是,当我在AKS上使用该docker映像时,我的应用程序启动后会失败几秒钟。

我激活了

logging.level.org.apache.tomcat=DEBUG

logging.level.org.apache.catalina=DEBUG

在我的application.properties中。我的应用程序的输出是:

2019-09-19 08:22:51.291  INFO 1 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 9.623 seconds (JVM running for 10.419)

2019-09-19 08:22:53.775 DEBUG 1 --- [o-8443-Acceptor] o.apache.tomcat.util.threads.LimitLatch : Counting up[https-jsse-nio-8443-Acceptor] latch=1

2019-09-19 08:22:58.764 DEBUG 1 --- [o-8443-Acceptor] o.apache.tomcat.util.threads.LimitLatch : Counting up[https-jsse-nio-8443-Acceptor] latch=2

2019-09-19 08:22:58.793 DEBUG 1 --- [nio-8443-exec-1] org.apache.tomcat.util.modeler.Registry : Managed= Tomcat:type=RequestProcessor,worker="https-jsse-nio-8443",name=HttpRequest1

2019-09-19 08:22:58.793 DEBUG 1 --- [nio-8443-exec-1] org.apache.tomcat.util.modeler.Registry : Looking for descriptor

2019-09-19 08:22:58.793 DEBUG 1 --- [nio-8443-exec-1] org.apache.tomcat.util.modeler.Registry : Introspecting

2019-09-19 08:22:58.793 DEBUG 1 --- [nio-8443-exec-1] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute virtualHost public java.lang.String org.apache.coyote.RequestInfo.getVirtualHost() null

<snipped 20 lines of "Introspected attribute xyz">

2019-09-19 08:22:58.796 DEBUG 1 --- [nio-8443-exec-1] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute lastRequestProcessingTime public long org.apache.coyote.RequestInfo.getLastRequestProcessingTime() public void org.apache.coyote.RequestInfo.setLastRequestProcessingTime(long)

2019-09-19 08:22:58.796 DEBUG 1 --- [nio-8443-exec-1] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute errorCount public int org.apache.coyote.RequestInfo.getErrorCount() public void org.apache.coyote.RequestInfo.setErrorCount(int)

2019-09-19 08:22:58.796 DEBUG 1 --- [nio-8443-exec-1] m.m.MbeansDescriptorsIntrospectionSource : Setting name: org.apache.coyote.RequestInfo

2019-09-19 08:22:58.797 DEBUG 1 --- [nio-8443-exec-1] o.a.tomcat.util.modeler.BaseModelMBean : preRegister org.apache.coyote.RequestInfo@21c6ab25 Tomcat:type=RequestProcessor,worker="https-jsse-nio-8443",name=HttpRequest1

2019-09-19 08:22:58.797 ERROR 1 --- [nio-8443-exec-1] o.a.coyote.http11.Http11NioProtocol : Error reading request, ignored

java.lang.NullPointerException: null

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.getSslSupport(NioEndpoint.java:1392) ~[tomcat-embed-core-9.0.24.jar:9.0.24]

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) ~[tomcat-embed-core-9.0.24.jar:9.0.24]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1593) ~[tomcat-embed-core-9.0.24.jar:9.0.24]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.24.jar:9.0.24]

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.24.jar:9.0.24]

at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

谁能给我一个提示我可能是什么问题?谢谢!

回答:

这是Apache Tomcat9.0.24中的一个已知错误。通过将纯文本发送到启用TLS的连接器来触发。可以忽略不计,但是由于它比较吵,您可能需要升级到已修复的最新版本9.0.26。

以上是 如何解决“ Http11NioProtocol:错误读取请求,被忽略” 的全部内容, 来源链接: utcz.com/qa/436300.html

回到顶部