bug笔记 - Spring --- Tomcat 报错: SEVERE: One or more listeners failed to start.
2017-11-16 22:03
561 查看
emmm, 最近把Spring框架也学的差不多了, 因为最近要开始迭代小组图书管理系统2.0, 不太有时间再总结Spring In Action的学习笔记了, 所以把Spring学习笔记先放一段时间啦~
后来才知道, 错误日志在/home/dela/.IntelliJIdea2017.1/system/tomcat/Unnamed_Spring_10(当前Project的名字)下, 也就是家目录下的.IntelliJIdea2017.1/system/tomcat, 然后找到本工程的tomcat名字, 进入logs目录就能看到当天的错误日志了.
我是在localhost.2017-11-16.log 中找到问题的原因的, 错误信息如下:
1. bug描述: 在写Spring代码的时候, 启动Tomcat时报错.
2. bug信息:
Connected to server [2017-11-16 09:28:36,551] Artifact Spring_10:war exploded: Artifact is being deployed, please wait... Nov 16, 2017 9:28:37 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile INFO: validateJarFile(/home/dela/IdeaProjects/Spring/Spring_10/out/artifacts/Spring_10_war_exploded/WEB-INF/lib/javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class Nov 16, 2017 9:28:38 PM org.apache.catalina.deploy.WebXml setVersion WARNING: Unknown version string [3.1]. Default version will be used. Nov 16, 2017 9:28:42 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined Nov 16, 2017 9:28:42 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.springframework.org/tags/form is already defined Nov 16, 2017 9:28:42 PM org.apache.catalina.startup.TldConfig execute INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Nov 16, 2017 9:28:43 PM org.apache.catalina.core.StandardContext startInternal **SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file** Nov 16, 2017 9:28:43 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [] startup failed due to previous errors [2017-11-16 09:28:43,528] Artifact Spring_10:war exploded: Error during artifact deployment. See server log for details.
3. bug解决:
这个bug相当诡异啊, 它诡异在IDEA的报错信息只有一句话: SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file, 信息里面提示去查看错误日志, 但是IDEA下面的错误日志是空! 这就很尷尬, 因为仅凭这一句话, 没办法定位错误出在哪里.(1) 找到错误日志
之前问过恒毅, 他说如果IDEA下面没有错误日志, 就去tomcat安装包下面的logs目录里面找, 但是然而并没有找到, 只有一些很久之前的错误日志.后来才知道, 错误日志在/home/dela/.IntelliJIdea2017.1/system/tomcat/Unnamed_Spring_10(当前Project的名字)下, 也就是家目录下的.IntelliJIdea2017.1/system/tomcat, 然后找到本工程的tomcat名字, 进入logs目录就能看到当天的错误日志了.
我是在localhost.2017-11-16.log 中找到问题的原因的, 错误信息如下:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/classpath*:db-config.properties] at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141) at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:153) at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98) at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:175) at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:156) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:80) ... 52 more
(2) 解决问题
原因是我的一个XML文件在载入properties配置文件时路径不对, 我把它放在了resources目录下(但是为什么放在resources目录下它会找不到现在还不清楚), 导致文件无法被加载, 将这个文件放入WEB-INF下, 通过/WEB-INF/db-config.properties就能访问加载到了!相关文章推荐
- Tomcat 8报错 SEVERE: One or more listener failed to start,如何找到更详细的错误信息
- 启动 Tomcat 报错 One or more listeners failed to start. Full details will be found in the appropriate
- 关于One or more listeners failed to start的问题排查
- Geoserver fails One or more listeners failed to start
- One or more listeners failed to start. Full details will be found in the appropriate container log
- one or more listeners failed to start
- 【报错】项目启动,仅仅报错 One or more listeners failed to start. Full details will be found in the appropriate container log file
- One or more listeners failed to start
- 关于Struts2报错严重: One or more Filters failed to start. Full details will be found in the appropriate co
- One or more Filters failed to start. Full details will be found in the appropriate container log fil
- Validation failed for one or more entities while saving changes to SQL Server Database
- IntelliJ IDEA启动spring boot项目出现Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
- DataSet hell - "Failed to enable constraints. One or more rows contain values...."
- android的imageView出现failed to instantiate one or more classes
- springboot打jar包部署 出现 Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
- DataTable - Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
- Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
- Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
- springboot出现 Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
- Failed to instantiate one or more classes