Hi,
We have a spring boot application (v3.1.4) It currently uses
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>10.1.13</version>
</dependency>
A renovate bot updated this package to 10.1.14 and now our app fails
on startup, with the following exception..
2023-10-11T22:27:16.981Z WARN 7 — [ main]
o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain
connection to query metadata
java.sql.SQLException: null
at
org.apache.tomcat.jdbc.pool.ConnectionPool.setupConnection(ConnectionPool.java:351)
~[tomcat-jdbc-10.1.14.jar!/:na]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:200)
~[tomcat-jdbc-10.1.14.jar!/:na]
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:133)
~[tomcat-jdbc-10.1.14.jar!/:na]
at
org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.j
Caused by: java.lang.IllegalArgumentException:
org.apache.tomcat.jdbc.pool.PooledConnection is not an interface
at
java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:706)
~[na:na]
at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:648)
~[na:na]
at
java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:440)
~[na:na]
at
java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
~[na:na]
at
java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
~[na:na]
at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:438)
~[na:na]
at java.base/java.lang.reflect.Proxy.getProxyClass(Proxy.java:398) ~[na:na]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getProxyConstructor(ConnectionPool.java:377)
~[tomcat-jdbc-10.1.14.jar:na]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.setupConnection(ConnectionPool.java:339)
~[tomcat-jdbc-10.1.14.jar:na]
The code throws the exceptino when lef.afterPropertiesSet() is called.
@Bean(name = "fsEntityManagerFactory")
public EntityManagerFactory entityManagerFactory(DataSource fsDataSource) {
LocalContainerEntityManagerFactoryBean lef = new
LocalContainerEntityManagerFactoryBean();
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
lef.setDataSource(fsDataSource);
lef.setJpaVendorAdapter(vendorAdapter);
lef.setPackagesToScan("xxxxxx");
lef.setPersistenceUnitName("fsPersistenceUnit");
HashMap<String, Object> properties = new HashMap<>();
properties.put("hibernate.dialect", "org.hibernate.dialect.DB2Dialect");
properties.put(AvailableSettings.ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT,
"false");
properties.put(AvailableSettings.ENHANCER_ENABLE_DIRTY_TRACKING, "false");
properties.put(AvailableSettings.ENHANCER_ENABLE_LAZY_INITIALIZATION, "false");
properties.put("hibernate.jdbc.fetch_size", hibernateFetchSize);
properties.put("hibernate.show_sql", hibernateShowSQL);
properties.put("hibernate.default_schema", hibernateDefaultSchema);
lef.setJpaPropertyMap(properties);
lef.afterPropertiesSet();
return lef.getObject();
}
Right now I've reverted back to 10.1.13 and it works.
What is the best way to fix this?
I saw the release notes, updates were changed to the connection
pooling classes, but I'm unsure on how to proceed.
Thank you,
Rich
CONFIDENTIALITY NOTICE:
This is a transmission from Kohl's, Inc. and may contain information which is
confidential and proprietary.
If you are not the addressee, any disclosure, copying or distribution or use of
the contents of this message is expressly prohibited.
If you have received this transmission in error, please destroy it and notify
us immediately at 262-703-7000.
CAUTION:
Internet and e-mail communications are Kohl's property and Kohl's reserves the
right to retrieve and read any message created, sent and received. Kohl's
reserves the right to monitor messages by authorized Kohl's Associates at any
time without any further consent.