嵌入式tomcat提供无法从类加载器层次结构中扫描jar

use*_*502 4 tomcat tomcat8 embedded-tomcat-8

我新尝试了嵌入式tomcat版本8.0.15。将Maven依赖项下载到我的项目中。

创建必要的上下文和实例。Tomcat服务器正常运行。但是我收到以下警告

Jun 17, 2017 9:50:44 PM org.apache.tomcat.util.scan.StandardJarScanner scan 
WARNING: Failed to scan  [file:/C:/Users/raghavender.n/.m2/repository/xalan/xalan/2.7.2/xercesImpl.jar] from classloader hierarchy
java.io.FileNotFoundException:C:\Users\raghavender.n\.m2\repository\xalan\xalan\2.7.2\xercesImpl.jar (The system cannot find the file specified)
WARNING: Failed to scan [file:/C:/Users/raghavender.n/.m2/repository/xalan/xalan/2.7.2/xml-apis.jar] from classloader hierarchy
java.io.FileNotFoundException: C:\Users\raghavender.n\.m2\repository\xalan\xalan\2.7.2\xml-apis.jar (The system cannot find the file specified)

<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core -->
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-core</artifactId>
    <version>8.5.15</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

如何禁用/避免来自嵌入式tomcat jar的警告?

小智 6

您可以 server.tomcat.additional-tld-skip-patterns=*.jar application.properties文件 server: tomcat: additional-tld-skip-patterns: '*.jar' 中添加,也可以在文件 中添加 application.yml

请参阅:Jar扫描仪组件官方答复

  • 是的 server.tomcat.additional-tld-skip-patterns=*.jar 工作,非常感谢 (2认同)

小智 4

不要认为xml-apis.jar是tomcat-embed-core所需的依赖项,如依赖项 hierachy所示。

对于您的错误,请确保xml-apis.jar的范围不是“提供的”,删除C:/Users/raghavender.n/.m2/repository/xalan/xalan/下的所有文件并执行“ mvn clean install ”,然后检查如果xml-apis.jar存在。

对于没有 Spring Boot 且嵌入 Tomcat 的Spring Web 应用程序,您可以参考这篇文章


归档时间:

查看次数:

6416 次

最近记录:

6 年,1 月 前