Issue
I have two WebApps (say, A.war and B.war) that rely on some common piece of code (say C.jar) to exchange information. So what I did in the two webapps' POM file I added the JAR with the scope "provided".
<dependency>
<groupId>some.web.app</groupId>
<artifactId>C</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
And I copied the C.jar into the Tomcat's lib folder, so that it will be shared. So when I try to deploy any of the war file, by copying the war file to the webapps folder and starting Tomcat, I see a bunch of missing JAR errors on startup:
25-Oct-2019 15:07:43.752 WARNING [main] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Failed to scan [file:/H:/apache-tomcat-9.0.27/lib/logback-classic-1.1.3.jar] from classloader hierarchy
java.io.FileNotFoundException: H:\apache-tomcat-9.0.27\lib\logback-classic-1.1.3.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
But all the JARs that Tomcat is complaining about are in a "lib" folder of C.jar. Is there a way to make Tomcat scan JARs inside the C.jar. I am not sure if what I am doing is right in the first place. I have played around with Tomcat/Maven before, but never in this detail. Any help would be appreciated.
Solution
I had the scanManifest setting under JARScanner set to true in the context.xml of Tomcat. I set it to false and the error went away.
<JarScanner scanAllDirectories="true" scanAllFiles="true" scanBootstrapClassPath="true" scanClassPath="true" scanManifest="false" />
Answered By - hell_storm2004