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

项目启动时出现棘手错误,更换mysql-connector-java和servlet-api版本无效。强调看错误日志要完整,戒骄戒躁。错误表现为listener加载失败和mysql驱动力的IllegalStateException,通过排查web.xml配置的listener解决问题,也指出日志报错提示可能有误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目启动过程中出现下面这个错误,比较棘手,更换了mysql-connector-java 和 servlet-api 的版本也没有起到作用 

11-Jul-2019 16:32:00.345 严重 [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
11-Jul-2019 16:32:00.346 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [/joyfarming] startup failed due to previous errors
11-Jul-2019 16:32:00.351 信息 [RMI TCP Connection(3)-127.0.0.1] org.springframework.context.support.AbstractApplicationContext.doClose Closing Root WebApplicationContext: startup date [Thu Jul 11 16:31:36 CST 2019]; root of context hierarchy
ContextFinalizer:Driver com.alibaba.druid.proxy.DruidDriver@25b85df8 deregistered
ContextFinalizer:Driver com.mysql.cj.jdbc.Driver@5335eaa6 deregistered
11-Jul-2019 16:32:00.353 信息 [RMI TCP Connection(3)-127.0.0.1] org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop Stopping beans in phase 2147483647
[16:32:00|INFO |com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed
[2019-07-11 04:32:00,548] Artifact joyfarming:war: Error during artifact deployment. See server log for details.
11-Jul-2019 16:32:05.061 信息 [mysql-cj-abandoned-connection-cleanup] 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:1372)
	at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1042)
	at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:117)
	at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:84)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

看错误日志一定要看完整,有时候只看一点日志碰巧能解决问题,但也有可能很长时间都没有解决问题,但原始日志却已经找不到了,这就是太过焦躁,眼高手低的原因造成的,一定要戒骄戒躁啊。

看前面是 listener 加载失败 后面又报 mysql 驱动力的IllegalStateException 问题。可以从两方面入手,一个看 web.xml 配置的 listener 排除不能加载的 listener ,经过排除发现去掉一下 配置项目就能起来了

<!-- 加载Log4J 配置文件  -->
  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <!--<param-value>WEB-INF/conf/log4j.properties</param-value>-->
    <param-value>classpath*:log4j.properties</param-value>
  </context-param>

  <context-param>
    <param-name>log4jRefreshInterval</param-name>
    <param-value>3000</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class><!--已包含WebAppRootListener的功能-->
  </listener>

这个问题暂且不用管,问题已经解决了。所以有可能日志报错 的 提示有可能就是错误的 引导你 向错误的方向 钻研。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值