不灭的焱

革命尚未成功,同志仍须努力

作者:php-note.com  发布于:2020-06-13 23:34  分类:Java  编辑

最近做项目的时候,遇到一个问题,项目启动不了,并且没有任何错误日志

1.Idea启动Tomcat时报错:

 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.

2.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目录 里面找,但是然而并没有找到,只有一些很久之前的错误日志。

后来才知道,错误日志在 C:\Users\wenjianbao\.IntelliJIdea2017.1\system\tomcat\(当前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) 解决问题

根据里面错误日志里面的提示成功解决了问题。

 

 

摘自:https://blog.csdn.net/qq_36349129/article/details/80608064