On 06/07/2010 08:22, Pid wrote:
> On 06/07/2010 08:05, Yevgen Krapiva wrote:
>> Hi guys.
>>
>> I have a servlet that uses connection pool with the use of MySQL driver.
>> When I start or reload Tomcat the application works fine, then if I
>> redeploy my application it cannot get a connection from a DataSource object.
>> The following exception is thrown:
>>
>> java.lang.IllegalStateException: Timer already cancelled.
>>
>> java.util.Timer.sched(Timer.java:354)
>> java.util.Timer.schedule(Timer.java:222)
>> org.apache.tomcat.dbcp.pool.impl.EvictionTimer.schedule(EvictionTimer.java:64)
>> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.startEvictor(GenericObjectPool.java:1647)
>> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.setTimeBetweenEvictionRunsMillis(GenericObjectPool.java:843)
>> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1173)
>> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
>> basis.onlineorder.commons.dao.UserDAOJdbcImpl.getUsers(UserDAOJdbcImpl.java:133)
>> org.apache.jsp.users_jsp.getUsersList(users_jsp.java:31)
>> org.apache.jsp.users_jsp._jspService(users_jsp.java:164)
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>
>> I have not found anything I can do with this on the internet. Perhaps I've
>> found that I might have a relation to
>> timeBetweenEvictionRunsMillis parameter ( in <Resource> configuration
>> section ).
>>
>> I don't know if it is important, here is my configuration in context.xml
>> file:
>>
>> <Resource name="jdbc/onlineorder"
>> auth="Container"
>> type="javax.sql.DataSource"
>> username="user"
>> password="password"
>> driverClassName="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost/mydb?useUnicode=true&amp;characterEncoding=utf8"
>> maxActive="10"
>> maxIdle="5"
>> testOnBorrow="true"
>> testWhileIdle="true"
>> timeBetweenEvictionRunsMillis="10000"
>> minEvictableIdleTimeMillis="60000"
>> />
>>
>> Did anyone face with this problem ?
> 
> Exactly which version of the MySQL driver are you using?
> 
> This is a side-effect of the memory leak prevention in Tomcat 6.0.20+
> which aims to stop Timers that haven't been properly shutdown.

Correction, Timer Thread termination was introduced in 6.0.24.
It's optional from 6.0.27 with the clearReferencesStopTimerThreads flag.

You might consider filing a bug with MySQL requesting that they check
that the Timer is actually running.


p


p

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to