How to fix "JARs that were scanned but no TLDs were found in them " in Tomcat 9.0.0M10

This is not a bug or any kind of problem in tomcat. Tomcat is just informing you that there are jars that do not contain TLDs and you can add them to the scanner's skip list to improve startup performance. So you have two options:

  1. You can safely ignore that hint. Yet if it annoy you, you can set that specific logger to a higher logging level, and thus prevent tomcat from logging it. Just add org.apache.jasper.servlet.TldScanner.level = SEVERE to the end of logging.properties.

  2. Enable the debug logging to make tomcat list those jars and add them to the skip list. Set:

    org.apache.jasper.compiler.TldLocationsCache.level = FINE
    org.apache.jasper.servlet.TldScanner.level = FINE
    

And add the printed jars names (without the path) to tomcat.util.scan.StandardJarScanFilter.jarsToSkip=... in tomcat_dir/conf/catalina.properties


Setting the logging to FINE, FINEST or ALL to find all jars to exclude is not neccessary.

Here is a script that finds all jars not containing TLDs (change the TOMCAT_HOME variable to match your installation) and outputs a list on the form

jar1.jar,\
jar2.jar,\
...

that can be pasted into catalina.properties (omit the last ',\'):

#!/bin/sh
TOMCAT_HOME=/opt/tomcat
for i in `find $TOMCAT_HOME -follow -name "*jar"`
do
    jar tvf $i | grep -i tld > /dev/null
    if [ $? -ne 0 ]; then
        echo "$(basename $i),\\"
    fi
done

However, if I am correctly informed, there is a possibility in tomcat 9 to exclude all jars by changing (in catalina.properties):

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\

to

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar

(comment away the list on the lines below) and then override that decision for jars containg TLDs by changing:

tomcat.util.scan.StandardJarScanFilter.jarsToScan=\
log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar

and add the list obtained by modifying the script above to list the jars that do contain TLDs:

#!/bin/sh
TOMCAT_HOME=/opt/tomcat
for i in `find $TOMCAT_HOME -follow -name "*jar"`
do
    jar tvf $i | grep -i tld > /dev/null
    if [ $? -eq 0 ]; then
        echo "$(basename $i),\\"
    fi
done

change conf\context.xml file

<Context>
    <!-- only if you do not use jsp tag -->
    <JarScanner>
        <JarScanFilter defaultPluggabilityScan="false" defaultTldScan="false"/>
    </JarScanner>
</Context>

see: https://tomcat.apache.org/tomcat-9.0-doc/config/jar-scan-filter.html