[英]Can't start tomcat ( org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: )
I am trying to develop a web application program I'm using tomcat 9
and hibernate
.我正在尝试开发一个 web 应用程序,我正在使用tomcat 9
和hibernate
。 my application was running correctly but suddenly i got this error:我的应用程序运行正常,但突然出现此错误:
18-May-2021 11:35:04.881 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
18-May-2021 11:35:04.882 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
18-May-2021 11:35:04.892 WARNING [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.[2021-05-18 11:35:04,905] Artifact servlet-hibernate:war exploded: Error during artifact deployment. See server log for details.
18-May-2021 11:35:09.620 INFO [Abandoned connection cleanup thread] 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:1384)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1037)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
and it could not deploy the artifact any more.它无法再部署工件。 and in order to find out the reason of this error:为了找出这个错误的原因:
18-May-2021 11:35:04.881 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
when I check the log file in tomcat I found these Errors:当我检查 tomcat 中的日志文件时,我发现了这些错误:
18-May-2021 11:45:13.814 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8081]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1049)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:556)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1045)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:724)
at org.apache.catalina.startup.Catalina.load(Catalina.java:746)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.Net.bind(Net.java:428)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:300)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:253)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1204)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1217)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:603)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:80)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1046)
... 13 more
18-May-2021 11:45:17.472 SEVERE [main] org.apache.catalina.core.StandardServer.await Failed to create server shutdown socket on address [localhost] and port [8005] (base port [8005] and offset [0])
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:382)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:584)
at org.apache.catalina.startup.Catalina.await(Catalina.java:864)
at org.apache.catalina.startup.Catalina.start(Catalina.java:810)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
by the way I can not find tomcat process with this command get-process|select-string "tomcat"
in windows PowerShell.顺便说一句,我在 windows PowerShell 中使用此命令get-process|select-string "tomcat"
找不到 tomcat 进程。 so I think the main problem is with starting the tomcat.所以我认为主要问题是启动 tomcat。
also you should know when I run this command:你也应该知道我什么时候运行这个命令:
c:\Tomcat\apache-tomcat-9.0.46-windows-x64\apache-tomcat-9.0.46\bin>startup.bat
in a CMD the following windows will appear. c:\Tomcat\apache-tomcat-9.0.46-windows-x64\apache-tomcat-9.0.46\bin>startup.bat
在 CMD 中会出现以下 Z0F41237ED1502B55A45。
and nothing will change, as long as I wait.只要我等待,什么都不会改变。
Conclusion: I think my tomcat is not started yet.结论:我认为我的 tomcat 还没有启动。 and also I wonder if I restarted the tomcat eventually would it be helpful to solve this Error:而且我想知道我是否最终重新启动了 tomcat 是否有助于解决此错误:
18-May-2021 11:35:09.620 INFO [Abandoned connection cleanup thread] 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 :1384)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1037)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I really get confused.我真的很困惑。 I appreciate any solution.我感谢任何解决方案。
Try to restart your server then restart IDE and rebuild project also may help.尝试重新启动您的服务器,然后重新启动 IDE 并重建项目也可能会有所帮助。 On the other hand you probably can find a process with your port using cmd and the following command netstat -ano | findstr "yourPortNumber"
另一方面,您可能可以使用 cmd 和以下命令netstat -ano | findstr "yourPortNumber"
找到您的端口的进程。 netstat -ano | findstr "yourPortNumber"
But I truly recommend you to check your configured port firstly using server.xml
file in your Tomcat directory and after that resolve your bind conflict.但我真的建议您首先使用server.xml
目录中的 server.xml 文件检查您配置的端口,然后解决您的绑定冲突。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.