Description
Describe the bug
We make use of aws advanced jdbc wrapper and when running integration tests with different test resources, i.e., grouped tests with Mysql, grouped tests with mysq and kafka, grouped tests with kafka, mysql and wiremock, only the first group passes as for the other groups the required aws driver is unregistered. Seems to be related to quarkus restarting in between groups as described in https://quarkus.io/guides/getting-started-testing#usage-of-withtestresource
> Task :integrationTest
DatabaseRepositoryIT STANDARD_OUT
2025-02-17 22:50:02,146 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) Available JDBC drivers:
2025-02-17 22:50:02,146 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 1. com.mysql.cj.jdbc.Driver
2025-02-17 22:50:02,146 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 2. software.amazon.jdbc.Driver
2025-02-17 22:50:02,146 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 3. org.testcontainers.jdbc.ContainerDatabaseDriver
.....
2025-02-17 22:50:41,663 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) Available JDBC drivers:
2025-02-17 22:50:41,663 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 1. com.mysql.cj.jdbc.Driver
2025-02-17 22:50:46,701 INFO [com.spo.odd.con.fix.kaf.UpdateHandlerIT] (Test worker) Setting up Kafka producer with bootstrap servers localhost:9093
UpdateHandlerIT > should_successfully_send_messages() STANDARD_OUT
2025-02-17 22:50:47,270 INFO [com.spo.odd.con.fix.kaf.UpdateHandlerIT] (awaitility-thread) Received 0 messages
Available JDBC drivers:
1. com.mysql.cj.jdbc.Driver
Failed to insert start time
java.lang.RuntimeException: Unable to get java.sql.Driver from DriverManager
at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:130)
at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:68)
at io.agroal.pool.ConnectionPool.<init>(ConnectionPool.java:112)
at io.agroal.pool.DataSource.<init>(DataSource.java:37)
at io.agroal.pool.DataSourceProvider.getDataSource(DataSourceProvider.java:21)
at io.agroal.api.AgroalDataSource.from(AgroalDataSource.java:41)
at io.agroal.api.AgroalDataSource.from(AgroalDataSource.java:33)
at io.vertx.ext.jdbc.spi.impl.AgroalCPDataSourceProvider.getDataSource(AgroalCPDataSourceProvider.java:93)
at io.vertx.ext.jdbc.impl.JDBCClientImpl.createDataSource(JDBCClientImpl.java:315)
at io.vertx.ext.jdbc.impl.JDBCClientImpl.lambda$getDataSourceHolder$6(JDBCClientImpl.java:297)
....
Caused by: java.sql.SQLException: No suitable driver
at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:300)
at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:128)
ServiceHandlerIT STANDARD_OUT
2025-02-17 22:51:05,205 INFO [io.sma.rea.mes.kafka] (smallrye-kafka-consumer-thread-0) SRMSG18224: Executing consumer revoked re-balance listener for group 'change-notifier'
2025-02-17 22:51:34,762 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) Available JDBC drivers:
2025-02-17 22:51:34,762 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 1. com.mysql.cj.jdbc.Driver
2025-02-17 22:51:34,771 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) Available JDBC drivers:
2025-02-17 22:51:34,772 WARN [com.spo.odd.con.fix.rep.VertxJDBCPoolConfig] (Test worker) 1. com.mysql.cj.jdbc.Driver
2025-02-17 22:51:34,773 ERROR [com.spo.odd.con.fix.rep.DatabaseRepository] (vert.x-eventloop-thread-2) Failed to save last poll time: java.lang.RuntimeException: Unable to get java.sql.Driver from DriverManager
at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:130)
at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:68)
at io.agroal.pool.ConnectionPool.<init>(ConnectionPool.java:112)
at io.agroal.pool.DataSource.<init>(DataSource.java:37)
at io.agroal.pool.DataSourceProvider.getDataSource(DataSourceProvider.java:21)
at io.agroal.api.AgroalDataSource.from(AgroalDataSource.java:41)
at io.agroal.api.AgroalDataSource.from(AgroalDataSource.java:33)
at io.vertx.ext.jdbc.spi.impl.AgroalCPDataSourceProvider.getDataSource(AgroalCPDataSourceProvider.java:93)
at io.vertx.ext.jdbc.impl.JDBCClientImpl.createDataSource(JDBCClientImpl.java:315)
at io.vertx.ext.jdbc.impl.JDBCClientImpl.lambda$getDataSourceHolder$6(JDBCClientImpl.java:297)
....
Caused by: java.sql.SQLException: No suitable driver
at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:300)
at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:128)
We had to add a workaround to make the tests pass:
@Produces
public JDBCPool createJdbcPool(Vertx vertx) throws SQLException {
if (DriverManagerHelper.getRegisteredDrivers().stream()
.noneMatch(driver -> driver.getClass().getName().equals("software.amazon.jdbc.Driver"))) {
DriverManager.registerDriver(new software.amazon.jdbc.Driver());
}
return vertxJDBCPoolConfig.createJdbcPool(vertx);
}
Worked fine in quarkus 3.17*.
I could not reproduce it with a separate project unfortunately... and can't spend much more time on this.
Consistent behaviour in different environments.
Expected behavior
Aws driver, and others, should not get unregistered between integration tests groups, or rather, should still be registered.
Actual behavior
Aws driver, and others, are unregistered, or are not registered between integration tests groups
How to Reproduce?
Not sure, tried to reproduce it with https://github.com/rsassoon/quarkus-3-18-sql-no-suitable-driver-found/tree/master
, but no success
Output of uname -a
or ver
Linux TRD-L-8X1L3T3 6.8.0-53-generic #55-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 15:37:52 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
Quarkus version or git rev
3.18+
Build tool (ie. output of mvnw --version
or gradlew --version
)
Gradle 8.12.1
Additional information
No response