https://issues.apache.org/bugzilla/show_bug.cgi?id=50664

           Summary: connectUsingDriver should use thread context
                    classloader to load driver
           Product: Tomcat Modules
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: jdbc-pool
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: bal...@gmail.com


The issue is described in this Stackoverflow question:
http://stackoverflow.com/questions/4790589/sqlexception-w-tomcat-7-0-jdbc-connection-pool-and-mysql

Summarized, in a situation where Spring is been used to manage the
`org.apache.tomcat.jdbc.pool.DataSource`, the JDBC driver class is not found,
even though it was placed in `${catalina.home}/lib`. The Tomcat JDBC throws the
following exception:

java.sql.SQLException: "com.mysql.jdbc.Driver"
    at
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:243)
    at
org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:176)

The source code of `PooledConnection` learns me that it is attempting to load
the driver by the same classloader as the `PooledConnection` class itself is
been loaded. This should rather have been the thread context classloader as
follows.

driver = (java.sql.Driver) Class.forName(poolProperties.getDriverClassName(),
    true, Thread.currentThread().getContextClassLoader()).newInstance();

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to