Is it possible to disable taglib scanning in Tomcat?

When launched, Tomcat recursively scans WEB-INF directories for TLD (Tag Library Descriptor) files. As a result, if webapp has many files in this directory, this slows down the startup process. Does anyone know if there is a way in this situation to completely disable the scan, or at least provide a filter to narrow the search?

+3
source share
4 answers

You can add processTlds attributes to the context,

  <Context processTlds="false" ... />

However, your TLDs defined in the JAR file will not work without JAR scanning. You must define all TLDs in WEB-INF.

+9
source

. Tomcat 7.0.40, , "processTlds = false", - (ContextConfig.processJarsForWebFragments()).

2 :

TOMCAT_HOME/conf/catalina.properties

org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar

StandardJarScanner , , my.war/META-INF/context.xml:

<Context processTlds="false">
    <JarScanner className="org.my.tomcat.NullJarScanner"/>
</Context>

, NullJarScanner tomcat lib, .war

+8

Tomcat 8 , META-INF\context.xml WAR. Tomcat.

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <JarScanner>
        <JarScanFilter tldSkip="*.*"/>
    </JarScanner>
</Context>

Related documentation is available here: http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html

+6
source

Alternatively (if you still prefer to scan some JARs), you can add new values ​​to the "tomcat.util.scan.DefaultJarScanner.jarsToSkip" property in "{TOMCAT_HOME} /conf/catalina.properties".

+1
source

Source: https://habr.com/ru/post/1718754/


All Articles