> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: [OT] tomcat 5.5.25 shared lib and sharing webapp jars > > Is that because the primordial ClassLoader will hand-out references to > any class already loaded by any ClassLoader, so if null is returned, > then the current ClassLoader knows it needs to do its own loading (if > it can)?
Mostly correct: the API of interest is ClassLoader.findClass(); every ClassLoader instance is supposed to call that method of its parent, and only attempt a load itself if a ClassNotFoundException occurs (null cannot be returned). If its load fails, it must throw a CNFE back to its caller. All of the above assumes standard delegation rules are being followed, which the servlet spec precludes. > Also, the WebappClassLoader has to be able to re-load classes that are > updated during runtime. In order to do that, it needs to know what has > been loaded and when. Yes, but that's actually done by restarting the webapp, not redefining an existing class. This results in a new instance of WebappClassLoader and a completely new node being created on the classloader tree. Note that JSPs are handled differently - there's a separate ClassLoader created for each JSP file, so they can be easily replaced when modified. - 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.