How to disable Tomcat JARScanner

Gonzalo Gallotti picture Gonzalo Gallotti · Jul 25, 2012 · Viewed 12.8k times · Source

How: To disable Tomcat JARScanner?
Why: To stop Tomcat scan every .jar in my LIB folder.

According to documentation it says that it is possible to disable it within context.xml. But it seems to not be working. (May be I am missing something) I made an exhaustive search in forums and could not find the solution.

This is in context.xml (not working yet):

<JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"></JarScanner>

Thanks in advance.

Answer

Lari Hotari picture Lari Hotari · Jan 15, 2015

You should add the JarScanner element as a child of the root Context element in the context.xml file.

I have this kind of META-INF/context.xml file in the war file for disabling the JarScanner:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"/>
</Context>