IDEA项目启动崩溃,控制台没有错误信息问题

6 篇文章 0 订阅
5 篇文章 0 订阅

idea中项目以线下环境启动,程序启动失败,项目无法访问,控制台打印部分日志如下

2020-01-06 19:35:55.170 | INFO  --- [RMI TCP Connection(3)-127.0.0.1] |      org.hibernate.validator.internal.util.Version :30   | HV000001: Hibernate Validator 5.2.4.Final
06-Jan-2020 19:35:57.481 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
06-Jan-2020 19:35:57.484 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
2020-01-06 19:35:57.478 | INFO  --- [RMI TCP Connection(3)-127.0.0.1] |      org.springframework.web.context.ContextLoader :345  | Root WebApplicationContext: initialization completed in 15109 ms
2020-01-06 19:35:57.495 | INFO  --- [RMI TCP Connection(3)-127.0.0.1] |   o.s.web.context.support.XmlWebApplicationContext :982  | Closing Root WebApplicationContext: startup date [Mon Jan 06 19:35:42 CST 2020]; root of context hierarchy
06-Jan-2020 19:35:57.546 WARNING [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [net.sf.log4jdbc.DriverSpy] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
06-Jan-2020 19:35:57.546 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.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.
[2020-01-06 07:35:57,595] Artifact dudu-erp-admin:war exploded: Error during artifact deployment. See server log for details.

可以看到日志中并没有错误信息,只是报了一个数据库JDCB驱动相关的警告,期初以为是因为打开的软件太多,系统内存不够,然后关闭了很多软件再次尝试仍然是报这个信息,然后又尝试了一波玄学操作:重启电脑,删除项目中的.idea文件夹和*.iml文件后再重启项目,这种做法一般在idea出现bug的时候可以解决,但是在这里问题还是无法解决。

在尝试了几种解决办法后仍然不能正常启动,就又从新从上往下看了遍日志,发先了两行藏在info日志中间的红色日志

06-Jan-2020 19:35:57.481 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
06-Jan-2020 19:35:57.484 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

到这里错误信息就稍微明了一些了,说是因为一个或多个侦听器无法启动导致的错误,详细日志需要查看容器日志文件。 看到这里就打开了Tomcat的catalina.2020-01-06.loglocalhost.2020-01-06.log 进行查找,然后在localhost*.log日志中找到了错误信息:

org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
 java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:297)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4738)

经过检查日志发现,是因为我之前为了处理区分项目线上线下环境时继承重写了org.springframework.web.context.ContextLoaderListener监听,在web.xml中配置时加入自己重写过的listener后,没有删除ContextLoaderListener监听导致的,删除后即可正常启动项目

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值