0

I implemented a self-signed ssl certificate for a the spring boot application. Although the results are coming as expected, I getting the below exception is thrown. Using Springboot: 2.1.8 and Tomcat: 9.0.24

I tried changing the protocol from 'org.apache.coyote.http11.Http11NioProtocol' with 'org.apache.coyote.http11.Http11Nio2Protocol'. But still getting the exception.

The exception thats thrown.

@Bean
    public TomcatServletWebServerFactory tomcatServletWebServerFactory() {
        TomcatServletWebServerFactory tomcatServletWebServerFactory = new TomcatServletWebServerFactory();
        tomcatServletWebServerFactory.setProtocol("org.apache.coyote.http11.Http11Nio2Protocol");
        return tomcatServletWebServerFactory;
    }
    at org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper.getSslSupport(Nio2Endpoint.java:1581) ~[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.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1685) [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 org.apache.tomcat.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:1087) [tomcat-embed-core-9.0.24.jar:9.0.24]
    at org.apache.tomcat.util.net.SecureNio2Channel$HandshakeReadCompletionHandler.failed(SecureNio2Channel.java:104) [tomcat-embed-core-9.0.24.jar:9.0.24]
    at org.apache.tomcat.util.net.SecureNio2Channel$HandshakeReadCompletionHandler.completed(SecureNio2Channel.java:97) [tomcat-embed-core-9.0.24.jar:9.0.24]
    at org.apache.tomcat.util.net.SecureNio2Channel$HandshakeReadCompletionHandler.completed(SecureNio2Channel.java:92) [tomcat-embed-core-9.0.24.jar:9.0.24]
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) [na:1.8.0_201]
    at sun.nio.ch.Invoker$2.run(Invoker.java:218) [na:1.8.0_201]
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) [na:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.24.jar:9.0.24]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Joel George
  • 62
  • 2
  • 12
  • See https://stackoverflow.com/questions/58005691/how-to-fix-http11nioprotocol-error-reading-request-ignored#comment102453824_58005691 – Moisés Sep 20 '19 at 12:56

1 Answers1

1

That is a known bug in Tomcat 9.0.24. It is triggered when you try and use plain text on an TLS enabled connector. The bug is fixed in the recently released 9.0.26.

Mark Thomas
  • 16,339
  • 1
  • 39
  • 60
  • Yes. I found the same in the in Bugzilla. But currently after upgrading to tomcat 9.0.26 , and when I try to execute the Jar that is created I am getting 'The port may already be in use or the connector' exception. This is only happening while executing the jar and not through bootRun. – Joel George Sep 23 '19 at 10:38
  • This is happening only with 9.0.26 tomcat. The same code is working fine with 9.0.24. Not sure why? – Joel George Sep 23 '19 at 10:41