Simone,

On 10/28/15 4:02 AM, simone.rodenbach....@devk.de wrote:
> I tried to google for the driver and classloader and found nothing that 
> helped me :-(

> I can only provide you with this information:
> 
> I configured the datasource in the context.xml
> 
> <Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"

Why are you overriding Tomcat's default DataSourceFactory with another one?

> maxActive="10" minIdle="2" maxIdle="10" maxWait="10000"
> minEvictableIdleTimeMillis="120000" timeBetweenEvictionRunsMillis="60000"
> username="xxx"
>         password="xxx"
> driverClassName="com.ibm.db2.jcc.DB2Driver"
> url="xxx;"
> validationQuery="select 1 from sysibm.sysdummy1" />
> 
> 
> The spring bean
> 
> <jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/xxx" 
> expected-type="javax.sql.DataSource" />
> 
> I created a test project. Because oft hat I'm sure that I don't start a 
> thread.

It doesn't have to be *your code* starting the thread directly. JDBC
drivers have a habit of launching their own cleanup threads and then not
offering any interface to stop them.

> But the log says:
> 
> Okt 28, 2015 8:41:15 AM org.apache.catalina.loader.WebappClassLoader 
> clearReferencesThreads
> SCHWERWIEGEND: The web application [/test] appears to have started a thread 
> named [Timer-0] but has failed to stop it. This is very likely to create a 
> memory leak.
> 
> I think this thread is started from 
> org.apache.commons.dbcp.BasicDataSourceFactory.

Nope, BasicDataSourceFactory doesn't have the word "thread" anywhere in
its code:
http://svn.apache.org/viewvc/commons/proper/dbcp/tags/DBCP_1_4/src/java/org/apache/commons/dbcp/BasicDataSourceFactory.java?view=markup

> I removed the db2cc4.jar to get an exception to inspect from where the driver 
> is loaded and got:
> 
>  Caused by: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
> at 
> org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)

That only tells you where the driver is loaded. It doesn't tell you when
the thread was launched.

After shutting-down your web application (and getting the warning about
the Timer-0 thread), can you take a thread dump and show us the stack
trace for the Timer-0 thread?

-chris

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

Reply via email to