Skip to content

When using HSQLDB, Hikari logs a warning message about the driver class name when the first connection is retrieved from the pool #23036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nanlei opened this issue Aug 21, 2020 · 4 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@nanlei
Copy link

nanlei commented Aug 21, 2020

WARN message in startup:
[ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=org.hsqldb.jdbcDriver was not found, trying direct instantiation.

Founds:
HSQLDB registered the JDBC Driver as org.hsqldb.jdbc.JDBCDriver to DriverManager now.

In org.springframework.boot.jdbc.EmbeddedDatabaseConnection, the driver class name is org.hsqldb.jdbcDriver

This maybe the mismatch cause HikariCP cannot get the driver due to below code:

while (drivers.hasMoreElements()) {
            Enumeration<Driver> drivers = DriverManager.getDrivers();
            Driver d = drivers.nextElement();
            if (d.getClass().getName().equals(driverClassName)) { //driverClassName mismatch
               driver = d;
               break;
            }
         }

So we got the WARN message from HikariCP?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 21, 2020
@wilkinsona wilkinsona self-assigned this Aug 26, 2020
@wilkinsona
Copy link
Member

Spring Boot will auto-configure a HikariDataSource for you rather than a DriverDataSource. No warning is logged with the former. Can you please share some details of how you've configured the DriverDataSource in the form of a complete yet minimal sample that reproduces the problem? You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Aug 26, 2020
@nanlei
Copy link
Author

nanlei commented Aug 26, 2020

Hi @wilkinsona,
According to the reference documents, only with below dependencies and no any configuration code.

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>2.3.2.RELEASE</version>
        </dependency>

The output when application start like this:

2020-08-13 09:18:08.837  INFO 2034 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-08-13 09:18:08.848  INFO 2034 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-08-13 09:18:08.848  INFO 2034 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-08-13 09:18:08.912  INFO 2034 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-08-13 09:18:08.912  INFO 2034 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 872 ms
2020-08-13 09:18:09.032  INFO 2034 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-08-13 09:18:09.037  WARN 2034 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=org.hsqldb.jdbcDriver was not found, trying direct instantiation.
2020-08-13 09:18:09.675  INFO 2034 --- [           main] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Driver does not support get/set network timeout for connections. (feature not supported)
2020-08-13 09:18:09.678  INFO 2034 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-08-13 09:18:09.907  INFO 2034 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-13 09:18:10.257  INFO 2034 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''

With the debug mode, I found the Hikari using the exact driver class name to compare when get the driver.
And the WARN message is from Hikari source code.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 26, 2020
@wilkinsona
Copy link
Member

Thanks, that additional log output is helpful. I can see that you also have a dependency on Tomcat (presumably via spring-boot-starter-web). I can also see that something is using the data source and it's at this point that the warning is logged. That's given enough to reproduce the problem.

@wilkinsona wilkinsona changed the title WARN message in startup when HSQLDB loaded When using HSQLDB, Hikari logs a warning message about the driver class name when the first connection is retrieved from the pool Aug 26, 2020
@wilkinsona wilkinsona added type: bug A general bug and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Aug 26, 2020
@wilkinsona wilkinsona added this to the 2.2.x milestone Aug 26, 2020
@wilkinsona
Copy link
Member

DatabaseDriver uses org.hsqldb.jdbc.JDBCDriver so fixing this will also address an inconsistency in our own codebase. We could use DatabaseDriver.HSQLDB.getDriverClassName() when defining EmbeddedDatabaseConnection.HSQL to ensure the two remain in sync in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants