Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Tomcat skip the scanning jars specified in DefaultJarScanner.jarsToSkip

In catalina.properties it says:

# List of JAR files that should not be scanned for configuration information
# such as web fragments, TLD files etc. It must be a comma separated list of
# JAR file names.
# The JARs listed below include:
# - Tomcat Bootstrap JARs
# - Tomcat API JARs
# - Catalina JARs
# - Jasper JARs
# - Tomcat JARs
# - Common non-Tomcat JARs
# - Sun JDK JARs
# - Apple JDK JARs
tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\

Can anyone explain WHY? For example, you have to include the jstl.jar in your libs, but if it's called jstl.jar, it skips it. I just don't understand what the point of skipping it is in the first place?

like image 539
Matthew Smith Avatar asked Aug 11 '12 01:08

Matthew Smith


People also ask

Where do I put JAR files in tomcat?

A web app's WEB-INF\lib folder and the Tomcat \lib directories are the best places to deploy JAR files in Tomcat.

What is Jar scanning?

The Jar Scanner element represents the component that is used to scan the web application for JAR files and directories of class files. It is typically used during web application start to identify configuration files such as TLDs or web-fragment.


1 Answers

The comment says it all: "files that should not be scanned for configuration information" ie. if you know that your jars don't have any configuration information, include them here, so tomcat won't look into it.

The bottom line is this: it will cut the time tomcat takes to finish booting.

It seems not very useful on small deployments, but believe me: it does make a huge difference in big deployments with hundreds of jar files.

If jars are not included, or if there is not a pattern to skip (such as a*.jar - to exclude everything that starts with "a"), then everything gets opened, read, to find out about configuration.

In the company I work for, we are using TC Server which is just a fancy Tomcat: without the patterns to skip jars, tc server takes about 20 minutes just to scan the jar files... then another 10 minutes to deploy everything.

When we added patterns to skip pretty much 99% , we were able to cut down the server startup to about 12 minutes - not perfect, but the whole thing is huge, therefore, it's a tradeof we accepted.

like image 199
AlexD Avatar answered Oct 05 '22 16:10

AlexD