Bug 53853 - Can tomcat-jdbc consider Thread#getContextClassLoader() for interceptors & JDBC drivers please?
Summary: Can tomcat-jdbc consider Thread#getContextClassLoader() for interceptors & JD...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal with 20 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 55444 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-11 19:48 UTC by Yang ZHONG
Modified: 2014-08-10 21:30 UTC (History)
1 user (show)



Attachments
Fixes PooledConnection to attempt to load the driver class form the TCCL as well. (1.91 KB, patch)
2012-10-05 10:31 UTC, rinswind
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yang ZHONG 2012-09-11 19:48:12 UTC
TOMCAT/lib/tomcat-jdbc.jar currently wouldn't load JDBC driver(s) or customized interceptors out of TOMCAT/webapps/WEB_APP/WEB-INF/lib.
E.g.
org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to inform interceptor of pool start.
java.lang.ClassNotFoundException: ...
         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:264)
         at org.apache.tomcat.jdbc.pool.PoolProperties$InterceptorDefinition.getInterceptorClass(PoolProperties.java:861)
         at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:443)
         at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:130)
         at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:112)
         at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:99)
         at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:123)

Moving JDBC driver(s) into TOMCAT/lib would cause memory leak mentioned @
HTTP://issues.apache.org/bugzilla/show_bug.cgi?id=48214
not to mention exposing jar/version conflicts to other TOMCAT/webapps.

Any chance for tomcat-jdbc including org.apache.tomcat.jdbc.pool.PoolProperties$InterceptorDefinition.getInterceptorClass
to consider Thread#getContextClassLoader() instead of current Class.forName please? Thanks!
Comment 1 rinswind 2012-10-05 10:31:08 UTC
Created attachment 29449 [details]
Fixes PooledConnection to attempt to load the driver class form the TCCL as well.
Comment 2 Filip Hanik 2014-08-07 20:15:49 UTC
Fixed in r1616584
Comment 3 Filip Hanik 2014-08-07 23:25:03 UTC
*** Bug 55444 has been marked as a duplicate of this bug. ***
Comment 4 Konstantin Kolinko 2014-08-10 21:30:39 UTC
(In reply to Filip Hanik from comment #2)
> Fixed in r1616584

With minor follow-ups in r1617115 and r1617165.