我该如何解决 java.lang.IllegalStateException: Illegal access:?

How can i solve java.lang.IllegalStateException: Illegal access:?

我正在使用 Eclipse 开发一个网络应用程序。一切正常,但有时当我尝试 publist-> 启动我的服务器时,我收到以下错误:

Oct 03, 2019 6:52:55 PM org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading
INFO: Illegal access: this web application instance has been stopped already. Could not load []. 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 []. 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:1383)
    at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1036)
    at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:117)
    at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:84)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

前几次,我只是重新启动服务器,它工作正常,但现在即使重新启动也无法解决问题。我在网上读到它,一些消息来源提到它可能是一个线程管理问题,但我不能再进一步了。有人可以提供一些信息吗?谢谢

mysql 驱动程序正在尝试在 Web 应用程序关闭时进行清理,这很好。不幸的是,它正在尝试加载额外的 classes 来执行此清理,并且 - 由于 Web 应用程序正在关闭 - class 加载不再可用。理想情况下,驱动程序会在首次加载时加载清理所需的所有 classes - 这将避免此问题。

如果您能弄清楚它正在尝试加载哪个 classes - 驱动程序源代码的检查应该会告诉您哪个 - 然后您应该能够在应用程序启动时自己加载它们,因为例如,ServletContextListener.

如果您创建了任何实体 class 并且忘记为任何特定列提供 ID,那么也会出现此问题。因此,将 @ID 分配给任何列并再次 运行 。您的问题将得到解决。