I am upgrading the tomcat and openjdk version for a project. Target: Tomcat 9.0.63 and openjdk-8u322-b06.
However, getting EOFException when using Tomcat 9.0.63 and openjdk-8u322-b06.
I don't know how to fix it.
Error occurs if using Tomcat 9.0.63 and openjdk-8u252-b09 or later version.
No errors occurs if using Tomcat 9.0.35 and openjdk-8u322-b06.
No errors occurs if using Tomcat 9.0.63 and openjdk-8u242-b08 or previous version.
[https-jsse-nio-443-exec-2] org.apache.coyote.http2.Http2AsyncParser$FrameCompletionHandler.failed Connection [1], Stream [0], Frame type [null], Error
java.io.EOFException
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper$NioOperationState.run(NioEndpoint.java:1659)
at org.apache.tomcat.util.net.SocketWrapperBase$OperationState.start(SocketWrapperBase.java:1068)
at org.apache.tomcat.util.net.SocketWrapperBase.vectoredOperation(SocketWrapperBase.java:1487)
at org.apache.tomcat.util.net.SocketWrapperBase.read(SocketWrapperBase.java:1330)
at org.apache.tomcat.util.net.SocketWrapperBase.read(SocketWrapperBase.java:1302)
at org.apache.coyote.http2.Http2AsyncParser.readConnectionPreface(Http2AsyncParser.java:55)
at org.apache.coyote.http2.Http2UpgradeHandler.init(Http2UpgradeHandler.java:253)
at org.apache.coyote.http2.Http2AsyncUpgradeHandler.init(Http2AsyncUpgradeHandler.java:41)
at org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch(Http2UpgradeHandler.java:328)
at org.apache.coyote.http2.Http2AsyncUpgradeHandler.upgradeDispatch(Http2AsyncUpgradeHandler.java:41)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Tomcat server.xml
<Connector port="9443" protocol="org.apache.coyote.http11.Http11NioProtocol"
SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" clientAuth="false"
compression="on" compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
sslProtocol="TLS"
sslEnabledProtocols="TLSv1.2"
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA"
keystoreFile="path" keystorePass="xxxx">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
</Connector>
port 443
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" clientAuth="false"
compression="on" compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
sslProtocol="TLS"
sslEnabledProtocols="TLSv1.2"
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA"
keystoreFile="path" keystorePass="xxxx">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
</Connector>
port 8080
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9443"
useBodyEncodingForURI="true" />
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443"
useBodyEncodingForURI="true" />
Solved. Tomcat 9.0.36+ and openjdk 8_252+ not support http2 and NioProtocol at the same time. It must be use apr protocol="org.apache.coyote.http11.Http11AprProtocol" and change the server.xml
<Connector port="9443" protocol="org.apache.coyote.http11.Http11AprProtocol"
SSLEnabled="true" scheme="https" secure="true"
maxThreads="150"
compression="on" compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig protocols="TLSv1.2,+TLSv1.1" certificateVerification="none">
<Certificate certificateKeystoreFile="xxx.keystore"
certificateKeystorePassword="xxx"
type="RSA" />
</SSLHostConfig>
</Connector>
If using protocol="org.apache.coyote.http11.Http11NioProtocol", it needs to remove <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
, no error occurs but http1.1 only.