I am trying to upgrade tomcat web container used by our application from version 8.5 to 9.x. We have JDBC resources defined on the context xml file which have JMX enabled. When the application starts up, exceptions are thrown while registering beans with MBeanServer due to java.time.Duration
not having a corresponding OpenType.
This happens for org.apache.tomcat.dbcp.dbcp2.BasicDataSource
which have methods that return values of type java.time.Duration
Exception:
Caused by: java.lang.IllegalArgumentException: Method org.apache.tomcat.dbcp.dbcp2.DataSourceMXBean.getMaxConnDuration has parameter or return type that cannot be translated into an OpenType
...
...
Caused by: javax.management.openmbean.OpenDataException: Cannot convert type: java.time.Duration
...
...
Caused by: javax.management.openmbean.OpenDataException: Cannot convert type: java.time.temporal.TemporalUnit
...
...
Caused by: javax.management.openmbean.OpenDataException: Recursive data structure, including java.time.Duration
https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.html
Is there a workaround for this?
Thanks!