> From: Gary Hirschhorn [mailto:[EMAIL PROTECTED] > Subject: RE: Classes in tomcat\server\lib folder sometimes > are visible to web application > > The Catalina ClassLoader in server/lib creates Webapp1 ClassLoader > specifically for webapp1.
It's actually org.apache.catalina.loader.WebappLoader that creates each webapp's classloader, but the result is the same as you surmised. > the only way for this to work in practice is that these specific > implementations are referenced in Webapp1 as Interfaces which are > defined NOT in server/lib, but rather by jars higher up in hierarchy, > such as common/lib. Essentially correct; in addition to Interface classes, there are also abstract classes in the top-level jars. > a) if my webapp code has any specific reference (e.g. the > Class name is in my code as a variable or parameter type) > to a class in server/lib, I should get a ClassDefNotFoundError. Correct. > b) however, if my webapp has a reference to an Interface defined > in common/lib and at runtime is handed a Class that implements > this class, I may not get a ClassDefNotFoundError. Not just may not, but should not. Be aware that Tomcat uses a fair amount of reflection to avoid having direct references at compile and load time; depending on what your code needs, you may have to do something similar. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]