重啟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的屬性值設為:reloadable="false",即<Context reloadable="false">。