I have implemented a Rest Web Service using apache CXF and I have set up the Tomcat's connection Pool provided in the org.apache.tomcat.jdbc.pool
.
Everything seems to work fine and my connection pool works but I am keep getting an exception related to the PoolCleaner
. The problem is that I cannot find a specific pattern on when this exception happens. It seems random to me and some times it different than the previous times. Sometimes happens when I start tomcat and other times when I access or deploy a web app.
So here is the exception that I get with its variations
Most of the times I get this:
Exception in thread "PoolCleaner[28224875:1372776292150]" java.lang.NullPointerException
at org.apache.tomcat.jdbc.pool.ConnectionPool.unregisterCleaner(ConnectionPool.java:1296)
at org.apache.tomcat.jdbc.pool.ConnectionPool.access$400(ConnectionPool.java:57)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.stopRunning(ConnectionPool.java:1364)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1341)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
and sometimes I get this
INFO: Illegal access: this web application instance has been stopped already. Could not load org.apache.tomcat.jdbc.pool.FairBlockingQueue$FairIterator. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.tomcat.jdbc.pool.FairBlockingQueue.iterator(FairBlockingQueue.java:233)
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1034)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1352)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "PoolCleaner[6345204:1372865832250]" java.lang.NoClassDefFoundError: org/apache/tomcat/jdbc/pool/FairBlockingQueue$FairIterator
at org.apache.tomcat.jdbc.pool.FairBlockingQueue.iterator(FairBlockingQueue.java:233)
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1034)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1352)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.FairBlockingQueue$FairIterator
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 5 more
Any ideas on why this is happening? How can I track its root cause? How can I resolve it?
Thanks
I solved it by doing the following steps(in Eclipse Mars),
I don't know if it was by chance but it worked for me after futile debugging and checking jar versions.
This error occurred for me in grails when a database migration script included another migration script, but that file was missing (e.g. grails-app/migration/dbchanges.groovy included grails-app/migration/changelog-1.0.0.groovy, but changelog-1.0.0.groovy had been deleted). Updating dbchanges.groovy fixed it.
Most of the times this is a follow-up error and something like "org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors " could be found earlier in catalina.out.
The previous error is then best found in tomcat /logs dir in a file localhost.log.
This will happen because of missing jar files or version of jar file is changed..
I got solution, after spend one day .