You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Youngstrom <yo...@gmail.com> on 2011/07/29 23:49:01 UTC

Support for a jarsToInclude property?

I'm working with Tomcat 7 using web xml fragements and Servlet annotations.
 When metadata-complete="false" startup time is bad.  It can be improved by
excluding jars using tomcat.util.scan.DefaultJarScanner.jarsToSkip.  This is
great except now everytime I add a jar I need to add it to this list to keep
my startup time good.  I also want to be very careful about what jars are
adding configuration to my servlet container.  I would like to be able to
selectively allow these jars to be involved in scanning and then disable all
other jars.

It would seem that for my use case adding
a  tomcat.util.scan.DefaultJarScanner.jarsToInclude property would be very
useful.  Then I could do something like:

 tomcat.util.scan.DefaultJarScanner.jarsToSkip=*.jar
 tomcat.util.scan.DefaultJarScanner.jarsToInclude=spring-web*.jar,some-other*.jar

Or if there is a collection of jars with a similar pattern that I know don't
need to be scanned except for maybe one or two I can do something like:

 tomcat.util.scan.DefaultJarScanner.jarsToSkip=spring-*.jar
 tomcat.util.scan.DefaultJarScanner.jarsToInclude=spring-web*.jar

Included jars would take precedence over skipped jars.

Thoughts?  I'd be happy to provide a patch if others think such a feature
would be useful?

Mike

Re: Support for a jarsToInclude property?

Posted by Ognjen Blagojevic <og...@gmail.com>.
On 30.7.2011 0:27, Konstantin Kolinko wrote:
> 2. Note that you can configure JarScanner element in context.xml.
> Maybe it is worth to add a pair of such attributes (skip/include)
> there?
>
> http://tomcat.apache.org/tomcat-7.0-doc/config/jar-scanner.html

That makes sense. Most of the jar files are anyway in webapps WEB-INF 
folder, so it is natural to keep jar scanner configuration local to the 
context.

-Ognjen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Support for a jarsToInclude property?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/7/30 Michael Youngstrom <yo...@gmail.com>:
> I'm working with Tomcat 7 using web xml fragements and Servlet annotations.
>  When metadata-complete="false" startup time is bad.  It can be improved by
> excluding jars using tomcat.util.scan.DefaultJarScanner.jarsToSkip.  This is
> great except now everytime I add a jar I need to add it to this list to keep
> my startup time good.  I also want to be very careful about what jars are
> adding configuration to my servlet container.  I would like to be able to
> selectively allow these jars to be involved in scanning and then disable all
> other jars.
>
> It would seem that for my use case adding
> a  tomcat.util.scan.DefaultJarScanner.jarsToInclude property would be very
> useful.  Then I could do something like:
>
>  tomcat.util.scan.DefaultJarScanner.jarsToSkip=*.jar
>  tomcat.util.scan.DefaultJarScanner.jarsToInclude=spring-web*.jar,some-other*.jar
>
> Or if there is a collection of jars with a similar pattern that I know don't
> need to be scanned except for maybe one or two I can do something like:
>
>  tomcat.util.scan.DefaultJarScanner.jarsToSkip=spring-*.jar
>  tomcat.util.scan.DefaultJarScanner.jarsToInclude=spring-web*.jar
>
> Included jars would take precedence over skipped jars.
>

1. I think it is OK. The example with spring framework is a good one.

Setting jarsToSkip=*.jar (or just an empty string) as the global
value, though, will affect other unsuspecting web applications that
you could deploy on the same host.


2. Note that you can configure JarScanner element in context.xml.
Maybe it is worth to add a pair of such attributes (skip/include)
there?

http://tomcat.apache.org/tomcat-7.0-doc/config/jar-scanner.html


3. There are several tasks performed by JAR scanner one is the
scanning for servlets and fragments.  Another one is scanning for TLD
files.

Note:  Jar scanning for TLDs is performed only when compiling a page
that has tags in it. So, to reproduce the message printed by
TldLocationsCache one has to remove compiled JSP pages and request
loading such a page with a web browser.

Also here is interaction between Catalina (servlet container) and
Jasper (JSP compiler).

4. I wonder how JarScanner is configured and used when precompiling JSP pages.


> Thoughts?  I'd be happy to provide a patch if others think such a feature
> would be useful?


At least it would be some exercise to study Tomcat code.


5. I thought maybe JarScanner could be taught to ignore some paths,
e.g. ${java.home}. This is a different issue, though.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org