Embedded tomcat giving failed to scan jars from classloader hierarchy
Asked Answered
B

3

11

I am newly trying out Embedded tomcat version 8.0.15. Downloaded the maven dependency into my project.

Create the necessary context and instances. Tomcat server is coming up fine. But I am getting the below warnings

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>

How can i disable/avoid the warnings from embedded tomcat jar?

Benner answered 17/6, 2017 at 16:35 Comment(0)
H
4

Do not think xml-apis.jar is a dependency needed by tomcat-embed-core as shown with dependency hierachy.

For your error, make sure scope of xml-apis.jar is not "provided", delete all files under C:/Users/raghavender.n/.m2/repository/xalan/xalan/ and do "mvn clean install" then check if xml-apis.jar is there.

For Spring Web Application with Embeded Tomcat without Spring Boot , you may refer to this post.

Horlacher answered 19/6, 2017 at 6:25 Comment(0)
L
25

you can add server.tomcat.additional-tld-skip-patterns=*.jar in application.propertiesfile or server: tomcat: additional-tld-skip-patterns: '*.jar' in application.ymlfile.

Refer : The Jar Scanner ComponentThe official reply.

Lucchesi answered 7/6, 2018 at 13:54 Comment(3)
yep server.tomcat.additional-tld-skip-patterns=*.jar woks, thanks so muchSchoenberg
Beware of https://mcmap.net/q/17122/-how-to-install-jstl-it-fails-with-quot-the-absolute-uri-cannot-be-resolved-quot-or-quot-unable-to-find-taglib-quot-or-noclassdeffounderror-or-classcastexceptionTav
this solution may cover the issues caused by real missing dependency, specified by META-INF\MANIFEST.MF Class-Path property, so you may avoid wild card like *.jar aka ALL and filter specific jars only. See tomcat.apache.org/tomcat-10.0-doc/config/jar-scanner.htmlImpuissant
H
4

Do not think xml-apis.jar is a dependency needed by tomcat-embed-core as shown with dependency hierachy.

For your error, make sure scope of xml-apis.jar is not "provided", delete all files under C:/Users/raghavender.n/.m2/repository/xalan/xalan/ and do "mvn clean install" then check if xml-apis.jar is there.

For Spring Web Application with Embeded Tomcat without Spring Boot , you may refer to this post.

Horlacher answered 19/6, 2017 at 6:25 Comment(0)
P
0

For workaround, in catalina.properties file put the following line:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar
Packsaddle answered 17/2, 2020 at 15:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.