+1, there is no real other option AFAIK until you init at bootstrap the pool (initial size) to ensure it is in one tomcat classloader.
Le jeu. 25 juil. 2019 à 07:08, Clemens Wyss DEV <clemens...@mysign.ch> a écrit : > I tried posting this in the tomcat-users-ml, but I guess it rather fits > here: > > Context: > Debian GNU/Linux 9 \n \l > java version 1.8.0_162 > Tomcat 8.5.35 > > From time to time we are facing the follwing exception (call stack): > ... > Caused by: java.sql.SQLException: Unable to load class: > org.mariadb.jdbc.Driver from ClassLoader:java.net.URLClassLoader@4c873330 > ;ClassLoader:null > at > org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:292) > at > org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198) > at > org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132) > at org.apache.torque.Torque.getConnection(Torque.java:924) > ... 53 common frames omitted > Caused by: java.lang.ClassNotFoundException: Unable to load class: > org.mariadb.jdbc.Driver from ClassLoader:java.net.URLClassLoader@4c873330 > ;ClassLoader:null > at > org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) > at > org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280) > ... 59 common frames omitted > Caused by: java.lang.ClassNotFoundException: Classloader is null > at > org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:40) > ... 60 common frames omitted > > According to the code (in PooledConnection# connectUsingDriver) > Thread.currentThread().getContextClassLoader() returns null > > Googling for " Thread.currentThread().getContextClassLoader() is null" the > common demoniator seems to be `getContextClassLoader can be null`. If this > is true there should be > a) a null-check in PooledConnection# connectUsingDriver > b) if null, then there should be a fallback-Classloader (the system class > laoder?) > > WDYT ? > > Or any ideas why the given exception pops up from time to time > > Thx > Clemens > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >