title: Upgrade from Tomcat 8.0.39 to 8.0.41 results in 'failed to scan' errors
body: <p>I have a Spring Boot WAR application perfectly working under Tomcat 8.0.39 on AWS. After issuing <code>sudo service tomcat8 stop</code>, upgrading to Tomcat 8.0.41 through <code>sudo yum update</code>, and rebooting the instance, the application does not start. In the catalina log file, I see a ton of exceptions of the type:</p>
  
  <pre><code>19-Feb-2017 10:27:15.326 WARNING [localhost-startStop-1] org.apache.tomcat.util.
  scan.StandardJarScanner.scan Failed to scan [file:/usr/share/java/tomcat8/javax.
  annotation-api.jar] from classloader hierarchy
   java.io.FileNotFoundException: /usr/share/java/tomcat8/javax.annotation-api.jar
   (No such file or directory)
  </code></pre>
  
  <p>Here are the files Tomcat complains about:</p>
  
  <pre><code>javax.annotation-api.jar
  jsr181-api.jar
  jaxb-api.jar
  javax.xml.soap-api.jar
  FastInfoset.jar
  mimepull.jar
  saaj-impl.jar
  stax2-api.jar
  woodstox-core-asl.jar
  jaxb-core-2.2.10-b140802.1033.jar
  jaxb-api-2.2.12-b140109.1041.jar
  istack-commons-runtime-2.19.jar
  txw2-2.2.10-b140802.1033.jar
  hk2-core.jar
  class-model.jar
  config.jar
  auto-depends.jar
  javax.inject.jar
  hk2-api.jar
  osgi-resource-locator.jar
  tiger-types.jar
  bean-validator.jar
  jtype.jar
  </code></pre>
  
  <p>Any suggestions on how to fix this?</p>
  
  <hr>
  
  <p><strong>Update #1:</strong></p>
  
  <p>Some of the above files belong to <code>jaxws-ri</code>. It turned out that I had some (10), but not all (23), of the jars from JAX-WS RI 2.2.10 <code>lib</code> directory copied into Tomcat's <code>lib</code> directory. After copying the missing 13 jars, the list of files Tomcat complains about in the catalina log file has shrunk to:</p>
  
  <pre><code>jaxb-core-2.2.10-b140802.1033.jar
  jaxb-api-2.2.12-b140109.1041.jar
  istack-commons-runtime-2.19.jar
  txw2-2.2.10-b140802.1033.jar
  hk2-core.jar
  class-model.jar
  config.jar
  auto-depends.jar
  javax.inject.jar
  hk2-api.jar
  osgi-resource-locator.jar
  tiger-types.jar
  bean-validator.jar
  jtype.jar
  </code></pre>
  
  <p>(Exceptions for the above files are repeated several times in the log file. Looks like the scanner is invoked repeatedly at startup, perhaps scanning different class paths.)</p>
  
  <p>This tells me that with the transition from 8.0.39 to 8.0.41, Tomcat suddenly became very picky about the presence of all referenced jars, even though the application works perfectly fine without many of them. In addition, Tomcat appears to be very particular about specific builds of some jars (e.g. see the <code>jaxb-core...</code> and <code>jaxb-api...</code> jars above).</p>
  
  <p>Now, to fix this I could try to find all these missing jars and copy them to Tomcat's <code>lib</code> directory. However, I see no way of assuring the proper source for some of them due to generic names, such as <code>config.jar</code>, or missing version numbers.</p>
  
  <p>So, is there a way to prevent Tomcat's <code>scan.StandardJarScanner.scan</code> from being so picky about all these jars?</p>
  
  <hr>
  
  <p><strong>Update #2:</strong></p>
  
  <p>It turns out that in Tomcat 8.0.38, a setting was added to control jar scanning, the value of which defaults to <code>true</code>. To turn scanning off, add the following line in <code>context.xml</code>:</p>
  
  <pre><code>&lt;Context&gt;
    ...
    &lt;JarScanner scanManifest="false"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>For details, see
  <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59961" rel="noreferrer">Provide an option to disable processing of Class-Path entry in a jar's manifest file</a>.</p>