Tomcat | SEVERE: Error listenerStart
程序员文章站
2022-07-14 17:07:42
...
版本说明:
操作系统:CentOS 6.6 x64
JDK:1.7.0_55
Tomcat:7
问题描述:
迁移Tomcat工程启动后日志出现报错,内容如下:
Jan 20, 2018 7:02:50 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 20, 2018 7:02:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Jan 20, 2018 7:02:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8680"]
Jan 20, 2018 7:02:49 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 30535 ms
从以上内容中并不能获得到关键信息,其中只提示了有错误存在却没有说明故障点,此时需要修改日志级别来打印更多的信息来帮助我们排错,方法如下。
解决方案:
在tomcat工程中的classes路径下,在文件logging.properties中添加如下内容,如没有该文件则直接创建。
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
接下来重启Tomcat,然后再查看日志,我所遇到的问题如下:
Jan 20, 2018 7:07:20 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSourceHbe' defined in file
[/root/svn/busservice/WebContent/WEB-INF/classes/applicationContext_hbe.xml]: Could not resolve placeholder 'hbe.driver' in string value "${hbe.driver}"
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:220)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:669)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
通过以上信息确认问题是出现在数据库连接上,将连接信息重新修改后重启Tomcat,“SEVERE: Error listenerStart”没有再次出现。
总结:
以上介绍了在排错中可以通过修改Tomcat日志级别的方式来获取更多的日志信息,进而帮助我们排错,而具体的问题就要结合实际情况去确认,并非导致“SEVERE: Error listenerStart”的原因都一致。
参考资料:
http://blog.csdn.net/wsm0712syb/article/details/50946409
Tank
2018.1.29
推荐阅读
-
基于Java Tomcat和激活MyEclips的深入理解
-
spring-boot-starter-web更换默认Tomcat容器的方法
-
Eclipse中导入Maven Web项目并配置其在Tomcat中运行图文详解
-
MYSQL ERROR 1045 (28000): Access denied for user (using password: YES)问题的解决
-
Codeigniter中禁止A Database Error Occurred错误提示的方法
-
MySQL无法读表错误的解决方法(MySQL 1018 error)
-
springboot项目打成war包部署到tomcat遇到的一些问题
-
Tomcat 6.0下如何配置环境变量基本步骤分享
-
IE10 Error.stack 让脚本调试更加方便快捷
-
eclipse删除tomcat6.0后无法重新配置该怎么办?