On 6/22/2011 10:16 AM, Jess Holle wrote:
On 6/22/2011 9:08 AM, Mark Thomas wrote:
Another issue is that WEB-INF/lib is visible to the parent classloader
embedding Tomcat and to Tomcat as part of the web application and thus
I'm probably getting double scanning -- though really Tomcat should be
avoiding this by detecting that the same jar file is involved in both
cases.  The reasons for the duplication in this classpath are long and
historic.  Overall I'd rather not try to unwind this now.  I'd
hope/assume that an annotation on a class, e.g. a filter annotation,
would only result in one filter instance irrespective of how many times
that class is visible to the classloader(s) in question.
That sounds like it might cause trouble. Classes are identified by the
combination of name and class loader so the same class loaded in two
different class loaders is treated as a different class. If both the web
application class loader and its parent class loader can see WEB-INF/lib
I can image all sorts of things may go wrong.
Well the classloaders are clearly hierarchical, so only one Class instance is loaded. The fact that both ClassLoaders can see the jar does not result in 2 Class objects -- nor should it result in an annotation being applied multiple times. The jars are in fact exactly the same here -- as one of the web app's WEB-INF/lib directories is visible to the parent classloader. It may be possible to move the jars somewhere else so that they're only part of the parent classloader, but that will require more reshuffling of the longstanding configuration.
I increased the verbosity for the StandardJarScanner logger. Based on that output everything appears ok for our use case. The only duplicated jars we have are in WEB-INF/lib which is already automatically ignored when scanning the classpath.

The only issue I found at this level is that both tomcat-juli-adapters.jar and tomcat-juli-adapters.jar are scanned. I'd think that all the Tomcat "extras" jars should be in Tomcat's out-of-the-box list of jars to be ignored -- unless they actually shouldn't be ignored, of course. That's a rather minor issue, though -- and presumably accounts for very, very little of the startup time.

--
Jess Holle

Reply via email to