天天看點

關閉Tomcat出現異常:Illegal access:this web application instance has been stopped already

重新開機Tomcat時或(tomcat服務開啟,重新部署項目時),出現如下異常:

資訊: Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  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:1272)

 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)

 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

 at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:161)

 at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2759)

 at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1410)

 at com.mysql.jdbc.Connection.realClose(Connection.java:4947)

 at com.mysql.jdbc.Connection.cleanup(Connection.java:2063)

 at com.mysql.jdbc.Connection.finalize(Connection.java:3403)

 at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)

 at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)

 at java.lang.ref.Finalizer.access$100(Finalizer.java:14)

 at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

原因是:tomcat重新裝載web應用程式失敗導緻的。當應用程式解除安裝時,并不會關閉所有的線程。當tomcat已經關閉了其類加載器後,一些線程依然會繼續運作,這樣就導緻出錯。不過這個不影響正常使用,不管影響不影響,看到異常資訊就不順眼。

解決方案:修改tomcat目錄下的context.xml,找到<Context>标簽,設定reloadble的屬性值為"false",即<Context reloadable="false">。

參考:https://blog.csdn.net/etjnety/article/details/7782965

繼續閱讀