[已解決]Tomcat重新部署項目報錯this web application instance has been stopped already


解決方法:

重新部署時關掉游覽器中正在訪問項目的頁面,或者重啟服務器都可以解決該問題。

 

問題分析:

當熱部署Web應用程序時,可能因IDE進行熱部署或者重新部署項目時,因之前在游覽器中創建的線程仍在運行。但重新部署后他們的類加載器/上下文是無效的,並且由於它的原始web應用程序(以前的運行時環境)已被重新部署,因此面臨非法訪問異常/非法狀態異常。

因此,正如此處所述,重新啟動並不能永久解決此問題。所以最好實現線程池的托管。

 

今天在做畢業設計時因為修改了一點業務代碼,所有重新部署了下項目,然后就報了個錯。詳細錯誤信息如下:

org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading 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:1355)
    at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1025)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:90)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:63)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)

關鍵信息如下:

this web application instance has been stopped already. Could not load []. 

項目環境:

IDE:IDEA 2021.3.1

服務器:Tomcat8.0.50

游覽器:Microsoft Edge Bate

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM