Tomcat - java.io.FileNotFoundException - "WARNING: Failed to scan"

Problem

In the tomcat log, there are multiple java.io.FileNotFoundException exceptions similar to the following:

org.apache.tomcat.util.scan.StandardJarScanner scan WARNING: Failed to scan [file:/tmp/sealights/httpcore-4.4.5.jar] from classloader hierarchy java.io.FileNotFoundException: /tmp/sealights/httpcore-4.4.5.jar (No such file or directory) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.jar.JarFile.<init>(JarFile.java:166) at java.util.jar.JarFile.<init>(JarFile.java:130) at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60) at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:43) at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:322) at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:272) at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1887) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1127) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5202) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Cause

This is not an error, but rather just a warning that was introduced in Tomcat version 8.0.34 after fixing Apache's Bug 59226

Solution

Since Tomcat 8.0.38 you can configure and disable the scanning of the MANIFEST.MF file, see The Jar Scanner Component

To turn scanning off, add the following line in context.xml:

<Context> <JarScanner scanManifest="false"/> </Context>

References

https://bz.apache.org/bugzilla/show_bug.cgi?id=59226
https://bz.apache.org/bugzilla/show_bug.cgi?id=59961
https://tomcat.apache.org/tomcat-8.0-doc/config/jar-scanner.html
https://stackoverflow.com/questions/42329948/upgrade-from-tomcat-8-0-39-to-8-0-41-results-in-failed-to-scan-errors