javatomcattomcat7tomcat8

How to disable Tomcat JARScanner


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.


Solution

  • 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>