tomcat无法启动,也没找到错误日志

时间:2021-03-05 15:58:28

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

1. bug描述: 在做项目的时候, 启动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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

(2) 解决问题

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