由于threadlocal问题,Tomcat无法启动

时间:2016-03-02 11:27:19

标签: java tomcat thread-local

每当我在Tomcat上部署应用程序时,我都面临ThreadLocal的问题,说Thread已经启动但从未停止过。我已经研究了其他类似的StackOverflow问题,其中问题最终出现在代码中,这在堆栈跟踪中很明显。但就我而言,异常来自我在代码中使用的库,而不是来自我在代码中编写的内容。

以下是我在Tomcat控制台中可以看到的一些例外情况。

INFO: Illegal access: this web application instance has been stopped already.  Could not load javolution.util.FastTable$FastTableIterator.  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.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1743)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
        at javolution.util.FastTable.iterator(Unknown Source)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadedByThisOrChild(WebappClassLoaderBase.java:2795)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks(WebappClassLoaderBase.java:2713)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalsForLeaks(WebappClassLoaderBase.java:2668)
        at org.apache.catalina.loader.WebappClassLoaderBase.clearReferences(WebappClassLoaderBase.java:2174)
        at org.apache.catalina.loader.WebappClassLoaderBase.stop(WebappClassLoaderBase.java:2068)
        at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:661)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5822)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

此外,

INFO: Illegal access: this web application instance has been stopped already.  Could not load net.sf.ehcache.concurrent.LockType.  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.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1743)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
        at net.sf.ehcache.store.FrontEndCacheTier.readLock(FrontEndCacheTier.java:642)
        at net.sf.ehcache.store.FrontEndCacheTier.getKeys(FrontEndCacheTier.java:495)
        at net.sf.ehcache.Cache.getKeys(Cache.java:1878)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)

最后这两个例外。

Feb 22, 2016 8:32:45 AM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [/test] created a ThreadLocal with key of type [test.util.persistence.PersistenceFacade$1] (value [test.util.persistence.PersistenceFacade$1@2c600630]) and a value of type [java.util.Stack] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.


INFO: Illegal access: this web application instance has been stopped already.  Could not load org.apache.http.pool.AbstractConnPool$3.  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.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1743)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
        at org.apache.http.pool.AbstractConnPool.closeIdle(AbstractConnPool.java:493)
        at org.apache.http.impl.conn.PoolingClientConnectionManager.closeIdleConnections(PoolingClientConnectionManager.java:288)
        at com.amazonaws.http.IdleConnectionReaper.run(IdleConnectionReaper.java:127)

有问题的解决方案吗?我尝试过重新启动服务器,重新启动计算机甚至是Tomcat的新安装,但这个问题似乎并没有消失。

0 个答案:

没有答案