Recently we started supporting HTTP2 for our servers. We have used the below configuration for upgrading the HTTP2 protocol. The build started without an error. But we are facing a critical issue after running the server that is, some of the requests are moved to 302 status code from the server. And I didn't find any exception in catalina.out file.
Configuration:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
SSLEnabled="true" acceptCount="1000" maxSpareThreads="75" maxThreads="500"
minSpareThreads="25" compression="on" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"
compression="on" />
<SSLHostConfig honorCipherOrder="false">
<Certificate certificateKeyFile="conf/server.key" certificateFile="conf/server.crt"/>
</SSLHostConfig>
</Connector>
There are some clues in the localhost_ log file. A NullPointerException was found in .invoke method. Only these requests are moved to 302 status code.
==> localhost.2019-10-24.log <==
24-Oct-2019 03:32:16.106 SEVERE [https-openssl-apr-8443-exec-16] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.NullPointerException
24-Oct-2019 03:32:16.843 SEVERE [https-openssl-apr-8443-exec-14] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.NullPointerException
==> localhost_access_log.2019-10-24.txt <==
121.244.91.22 - - [24/Oct/2019:03:32:12 -0700] POST /app/get_notification_count HTTP/2.0 200 73
121.244.91.21 - - [24/Oct/2019:03:32:14 -0700] POST /app/get_all_tag_details HTTP/2.0 200 4401
121.244.91.20 - - [24/Oct/2019:03:32:15 -0700] POST /app/get_notification_count HTTP/2.0 200 72
121.244.91.21 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 302 -
117.239.106.136 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 200 73
121.244.91.21 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 302 -
121.244.91.21 - - [24/Oct/2019:03:32:17 -0700] POST /app/get_all_user_details HTTP/2.0 200 1149
121.244.91.21 - - [24/Oct/2019:03:32:17 -0700] GET /app HTTP/2.0 200 2512
When I switch to other networks, it works (status code 200) without an error. I am totally confused about this scenario. The issue cannot be reproduced after restart the tomcat server.
Tomcat version: > 9
I would greatly appreciate it if you could help me with this.