I checked in a patch to DependClassLoader12 last night (which should appear in tonight's nightly) that seems to make jar replacement much better at least with my very limited testing. It was leaving the jar file open whenever it had to define a new Package. From your description, it sounds like it would eventually get garbage collected, but it may take quite a while. While servlets and beans are loaded the same way, if the package contains a load-on-startup servlet it would get loaded very early on (and define the package for everyone else). This means that the open jar file is very likely to be finalized by the time Tomcat actually starts serving pages.
You are also correct that the ProtectionDomain is still set even when using SimpleClassLoader. That is because DependClassLoader12 is the one that actually defines the class (and it sets the PD). SimpleClassLoader is only used to load resources (even under Java 1.1). It isn't used to load classes by itself. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, January 12, 2002 2:41 PM Subject: Re: Possible Explanation - Re: DO NOT REPLY [Bug 5684] - WEB-INF/lib jar file loading and operations problems. > Hi Bill, > > Oooh. I spoke up to soon. After further testing, I still have the same > problem BUT ONLY with regular bean or taglib classes in the jar. Servlet > classes in a jar are working great. But as soon as a bean class is loaded > from the jar, the same problems exist -- locked jar or 404 resulting from a > class not found exception and it also affects the servlet classes from that > point on. Even if I restart the context (remove then add), the same > problems exist. I'm trying to research the problem but I got to admit that > the tomcat code is pretty hefty to trace through due to my lack of > experience with the code. Are servlet classes loaded from a jar any > different from regular classes loaded from a jar? > > Any thoughts? > > Regards, > Mike > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "Bill Barker" <[EMAIL PROTECTED]> > Sent: Friday, January 11, 2002 8:55 PM > Subject: Re: Possible Explanation - Re: DO NOT REPLY [Bug 5684] - > WEB-INF/lib jar file loading and operations problems. > > > Bill, > > First I'd like to say that you are darn good. Everything worked perfectly. > What can I say. Thank you very much. I will put it through more extensive > testing but my initial tests which was to delete the jar, replace the jar, > restart contexts with jar reloading, servlet reloading, and full reloading > all worked. > > I do have one thing to clear up in my mind in understanding this class > loader mechanism. The simpleclassloader has one deficiency as it does not > define the protection domain in the define class method. But as far as I > can tell, dependentclassloader12 takes over and loads the class which will > defineclass with the protection domain. It appears that simpleclassloader > is used by dependentclassloader for getting the resources. DO I UNDERSTAND > THIS CORRECTLY? > > So the hierarchy is webapp loader (parent2), simpleclassloader (parent) then > dependentclassloader. > > Thanks again for your help and support. > > Aloha, > Mike > > > ----- Original Message ----- > From: "Bill Barker" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, January 11, 2002 2:56 PM > Subject: Re: Possible Explanation - Re: DO NOT REPLY [Bug 5684] - > WEB-INF/lib jar file loading and operations problems. > > > I checked in the change to LoaderInterceptor11 to allow it to optionally use > the SimpleClassLoader (which is mostly the code from AdaptiveClassLoader) > even under Java2. It should show up in tonight's nightly. > > To enable it, you set the use11Loader="true" attribute on the > LoaderInterceptor11 element in server.xml and re-start Tomcat. Hopefully > this will be more jar-friendly on reloads. > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, January 05, 2002 6:47 PM > Subject: Possible Explanation - Re: DO NOT REPLY [Bug 5684] - WEB-INF/lib > jar file loading and operations problems. > > > > Hi Bill, > > > > I downloaded the 3.3 source code and did some sniffing. From what I can > > tell, here is why 3.2 works and 3.3 does not work with regards to jar > files > > and it's classes. > > > > TC 3.2 - LoaderInterceptor uses new instances of the AdaptiveClassLoader > > (and subclasses for jdk12 support) to handle a context init. This > > classloader overrides classloader methods and does everything correctly. > > That's why it has no problem with loading classes from jar files using zip > > methods or jar file locking. It closes it's jar files after reading it's > > class files. > > > > TC 3.3 - LoaderInterceptor11 uses new instances of the jdk's > URLClassloader. > > What more can I say. Tomcat has no control over URLClassloader and it's > > operations. The problems you and Bojan pointed out are out of Tomcat's > > control. > > > > I'd like to know what you think. If I'm correct, the question is whether > or > > not you folks are going to punt to Sun. This will let me know what my > > course of action will be. > > > > Regards, > > Mike > > > > > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Saturday, January 05, 2002 12:34 PM > > Subject: Re: DO NOT REPLY [Bug 5684] - WEB-INF/lib jar file loading and > > operations problems. > > > > > > Bill, > > Is this patch in the 1/4 nightly build of 3.3? Which .java file was it? > > > > Regards, > > Mike > > > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, January 04, 2002 4:50 PM > > Subject: DO NOT REPLY [Bug 5684] - WEB-INF/lib jar file loading and > > operations problems. > > > > > > DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG > > RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT > > <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5684>. > > ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND > > INSERTED IN THE BUG DATABASE. > > > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5684 > > > > WEB-INF/lib jar file loading and operations problems. > > > > > > > > > > > > ------- Additional Comments From [EMAIL PROTECTED] 2002-01-04 > > 18:50 ------- > > There was a missing close statement in the app-ClassLoader. I've added it > > in, > > so that the jar file shouldn't stay open. This may fix part 1 (since 3.3 > > typically does GC much less often then 3.2). > > > > It is possible (if very unlikely) that being able to delete the jar file > may > > help with 2. > > > > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>