重启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