When you have a "Loader" tag for your "context" in the "server.xml" file, the class loading scheme of tomcat is broken. In this case, your custom Loader receieves, as a parent ClassLoader, an instance of the System ClassLoader, instead of an instance of the Shared ClassLoader (see http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html). This is because, when the "Loader" tag is present, the custom loader (typically a subclass of "WebappLoader") is created while reading the XML file, BEFORE knowing the parent container (and therefore, defore knowing the parent ClassLoader = Shared ClassLoader) [class ContextRuleSet, method begin(),line 253]. In this case, the default class loader is set to the SystemClassLoader [class ContainerBase, method getParentClassLoader(), line 580]. On the other hand, if you DON'T have the tag, the loader is created later [class StandardContext, method start, line 4022]. I consider this bug a a major one, as the class loading scheme is broken (I consider class loading as a fundamental element of J2EE). This bug prevents an easy professionnal development of web applications, as it imposes the manual copy of classes and jars into the apposite WEB-INF locations, instead of using a suited class loader allowing an easy share of classes between projets. Related bugs: ASF Bugzilla Bug 37054, ASF Bugzilla Bug 37302. Mathieu
There are plenty of ways to easily share classes and their object instances between webapps without using a custom loader ;) But I'll leave this bug open, we'll see if anyone cares to submit a patch.
*** This bug has been marked as a duplicate of 37054 ***