62

When starting the application or compiling JSP via ant, Tomcat 7 Jasper complains about superfluous or misplaced JAR file. I got below message

**compile-jsp:**
   [jasper] Jul 31, 2012 7:15:15 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
   [jasper] INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 

how to Skipping unneeded JARs during scanning can improve startup time and JSP compilation time in tomcat?

how to enable better output?

kenorb
  • 155,785
  • 88
  • 678
  • 743
gowthaman
  • 983
  • 3
  • 9
  • 9
  • 6
    can you edit the file located under `${catalina.home}/conf/logging.properties` setting `org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = FINE`, restart tomcat and then post the output? tomcat is not complaining about superfluous jars, but about missing tlds definitions and adjusting the log level will show you some more details (it will show you where tomcat is looking for the missing tlds and a suggestion on how to solve your issue) – ThanksForAllTheFish Jan 17 '13 at 09:30
  • 1
    For all those as me who also look for the answer - see @AlekseyNikitenko 's answer below : https://stackoverflow.com/a/39358436/1579667 Beware of the backslashes in the lines, without them it won't work (at least on Tomcat 7) – Benj Apr 03 '18 at 09:00

10 Answers10

51

Tomcat 8.5. Inside catalina.properties, located in the /conf directory set:

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

Or go into context.xml, located in Tomcat's /conf directory and add:

<JarScanner scanClassPath="false"/>
Alexey Nikitenko
  • 2,047
  • 2
  • 20
  • 30
  • 1
    don't forget to remove useless jars from `tomcat.util.scan.StandardJarScanFilter.jarsToScan=` - leave it empty if nothing is needed – bebbo Nov 14 '19 at 15:07
  • Still an issue in Tomcat 9, and this resolved a ten minute "pause" in Tomcat's startup. Trying to remember what in the world this is for? Struts? JSPs? Long forgotten. Many thanks. – michaelok Apr 09 '20 at 02:19
44

For Tomcat 8, I had to add the following line to tomcat/conf/logging.properties for the jars scanned by Tomcat to show up in the logs:

org.apache.jasper.servlet.TldScanner.level = FINE
peterh
  • 11,875
  • 18
  • 85
  • 108
Guno Heitman
  • 899
  • 8
  • 16
  • 1
    Message from the future: tomcat7 here, and this setting has only to be commented out from the default config. – peterh Aug 18 '17 at 17:18
  • 1
    Message from further in the future: You may need both the line listed above as well as the following line in logging.proprties for later releases of Tomcat: org.apache.jasper.servlet.TldScanner.level = FINE – mdahlman Dec 15 '17 at 23:04
15

The above solution did not work for me. Instead I simply removed the hash(#) from the last line of the logging.properties file, to make it work.

# To see debug messages in TldLocationsCache, uncomment the following line:
org.apache.jasper.compiler.TldLocationsCache.level = FINE

The next step is to add the jars that Tomcat 7 is looking for in catalina.properties files just after the following line

org.apache.catalina.startup.TldConfig.jarsToSkip=
skiabox
  • 3,449
  • 12
  • 63
  • 95
11

If it helps anyone, I just appended the contents of the below output file to the existing org.apache.catalina.startup.TldConfig.jarsToSkip= entry.

Note that /var/log/tomcat7/catalina.out is the location of your tomcat log.

egrep "No TLD files were found in \[file:[^\]+\]" /var/log/tomcat7/catalina.out -o | egrep "[^]/]+.jar" -o | sort | uniq | sed -e 's/.jar/.jar,\\/g' > skips.txt

Hope that helps.

Joseph Lust
  • 19,340
  • 7
  • 85
  • 83
8

The warning comes up because Tomcat scans all Jars for TLDs (Tagging Library Definitions).

Step1: To see which JARs are throwing up this warning, insert he following line to tomcat/conf/logging.properties

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

Now you should be able to see warnings with a detail of which JARs are causing the intial warning

Step2 Since skipping unneeded JARs during scanning can improve startup time and JSP compilation time, we will skip un-needed JARS in the catalina.properties file. You have two options here -

  1. List all the JARs under the tomcat.util.scan.StandardJarScanFilter.jarsToSkip. But this can get cumbersome if you have a lot jars or if the jars keep changing.
  2. Alternatively, Insert tomcat.util.scan.StandardJarScanFilter.jarsToSkip=* to skip all the jars

You should now not see the above warnings and if you have a considerably large application, it should save you significant time in deploying an application.

Note: Tested in Tomcat8

HopeKing
  • 3,317
  • 7
  • 39
  • 62
4

Uncomment this line (in /conf/logging.properties)

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

Work's for me in tomcat 7.0.53!

Eduardo Briguenti Vieira
  • 4,351
  • 3
  • 37
  • 49
4

For Tomcat 8, I had to add the following line to catalina.properties for preventing jars scanned by Tomcat:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=jsp-api.jar,servlet-api.jar
Elcin ABD
  • 127
  • 1
  • 2
3

None of the above worked for me (tomcat 7.0.62)... As Sensei_Shoh notes see the class above the message and add this to logging.properties. My logs were:

Jan 18, 2016 8:44:21 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

so I added

org.apache.catalina.startup.TldConfig.level = FINE

in conf/logging.properties

After that I got so many "offending" files that I did not bother skipping them (and also reverted to normal logging...)

gkar
  • 31
  • 1
1

The error message states which logger it is using, so set that logger .level:

[jasper] Jul 31, 2012 7:15:15 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar

So the logger is org.apache.jasper.compiler.TldLocationsCache. In your logging.properties file, add this line:

org.apache.jasper.compiler.TldLocationsCache.level = FINE
Sensei_Shoh
  • 689
  • 7
  • 14
0

If the extra entries in the log bother you but an extra second of start-up time doesn't, just add this to your logging.properties and forget about it:

org.apache.jasper.servlet.TldScanner.level = WARNING
Alex R
  • 11,364
  • 15
  • 100
  • 180