关于部署项目到tomcat,报FAIL - Application at context path [/imageDownloader_war] could not be started

参考:https://blog.csdn.net/yasi_xi/article/details/49642661

最近用tomcat部署一个javaweb项目遇到了一个问题。

就是 打开tomcat服务器首页,然后点击进入Manager App,手动打开项目。

结果发现,项目Running状态为false。所以尝试了一下手动Start项目。

出现了  报FAIL - Application at context path /JDYProject could not be started

关于部署项目到tomcat,报FAIL - Application at context path [/imageDownloader_war] could not be started_第1张图片

这样,我们去看 {CATALINA-HOME}/logs/catalina.xxxx-xx-xx.log 的日志文件。

发现  关于部署项目到tomcat,报FAIL - Application at context path [/imageDownloader_war] could not be started_第2张图片

26-Mar-2019 10:03:12.856 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
26-Mar-2019 10:03:12.857 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/javax.servlet-api-3.1.0.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Mar-2019 10:03:12.858 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/httpcore-4.4.1.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Mar-2019 10:03:12.863 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/zxw.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Mar-2019 10:03:12.864 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/aliyun-sdk-oss-2.8.3.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Mar-2019 10:03:12.865 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/fastjson-1.2.11.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Mar-2019 10:03:12.868 FINE [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/tomcat/webapps/servlet3-web/WEB-INF/lib/guava-20.0.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file. 

来了解决方案:

出现这样的log说明,这条log所指的 jar 做了TLDs的扫描,并且没有在其中找到 TLDs,并且建议打开debug级别的log,查看相关的 jar 文件,在 Tomcat 配置文件中忽略对这样的 jar 的TLDs扫描。

编辑 {CATALINA-HOME}/conf/logging.properties 文件,在文件末尾添加: 

org.apache.jasper.servlet.TldScanner.level = FINE

然后我们切换到 tomcat的日志文件目录

输入这个条命令:


egrep "No TLD files were found in \[file:[^\]+\]" /usr/tomcat/logs/catalina.out -o | egrep "[^]/]+.jar" -o | sort | uniq | sed -e 's/.jar/.jar,\\/g' > skips.txt

这个是我们自己的日志地址:            

 

然后日志文件夹会生成一个 文本   skips.txt

打开会出现这些jar包

关于部署项目到tomcat,报FAIL - Application at context path [/imageDownloader_war] could not be started_第3张图片

将上面的结果放到 {CATALINA-HOME}/conf/catalina.properties 文件中的 “tomcat.util.scan.StandardJarScanFilter.jarsToSkip=” 处,保存该文件

 

最好先删除  {CATALINA-HOME}/work 下的所有内容    重启 Tomcat
 

重启后,Tomcat 将不再对刚刚列出的 jar 文件做 TLDs 扫描,web components 的加载速度也会显著加快。

删除前面在 logging.properties 中添加的

 

org.apache.jasper.servlet.TldScanner.level = FINE

 

你可能感兴趣的:(tomcat)