最近linux服务器上的tomcat日志时不时的报错,虽然报错但是不影响正常业务。但是既然报错了肯定需要知道原因的。报错详情如下:
INFO [service%0043ache.data] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [net.sf.ehcache.store.disk.Segment$1]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [net.sf.ehcache.store.disk.Segment$1]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1335)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1321)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
at net.sf.ehcache.store.disk.Segment$HashIterator.<init>(Segment.java:997)
at net.sf.ehcache.store.disk.Segment.hashIterator(Segment.java:948)
at net.sf.ehcache.store.disk.DiskStore$HashIterator.<init>(DiskStore.java:999)
at net.sf.ehcache.store.disk.DiskStore$KeyIterator.<init>(DiskStore.java:1072)
at net.sf.ehcache.store.disk.DiskStore$KeyIterator.<init>(DiskStore.java:1072)
at net.sf.ehcache.store.disk.DiskStore$KeySet.iterator(DiskStore.java:910)
at net.sf.ehcache.store.disk.DiskStorageFactory$DiskExpiryTask.run(DiskStorageFactory.java:828)
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)
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)
我这产生问题的原因是:一个tomcat启动了两个进程。
解决办法:
1、查找出tomcat的进程,命令如下: ps -ef |grep tomcat
2、杀掉tomcat进程,命令如下: kill -9 tomcat的pid号
3、启动tomcat,恢复正常。 命令如下:sh startup.sh
为什么会产生两个进程呢?
在网上找了一大堆资料后,大致说法如下:
1、sh shutdown.sh 不能完全杀死tomcat或者是不能立马杀死tomcat
2、tomcat的con/server.xml中的context属性reloadable默认为true导致。
我觉得这个linux上启动两个tomcat进程和window的tomcat进程没杀死差不多。但是在windows上面,tomcat如果有一个进程在运行,再启动的时候就会报8080端口被占用。在Linux上却没有任何提示,这一点区别是不是可以说明在linux上可以手动进行类似的设置呢?