----- Original Message -----
From: "Bo Xu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
> * from several emails in Servlet-List:
> if you move the helper classes outside of the servlets
> directory, and put them into CLASSPATH, it will "force"
> these helper classes loaded by SystemClassLoader,
> I guess now we can be sure that : all such helper classes
> will be loaded by the same ClassLoader(SystemClassLoader).
Also there is a concept of a container wide libraries. For example in tomcat
it is the TOMCAT_HOME/lib directory. Any classes in jar files here are
loaded by the same classloader(different from the classloader which loads
the servlets) and are shared across all contexts in the container.
You can find a detail analysis of the classloading philosophy used in tomcat
at the following link
http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat-4.0/catalina/docs/
dev/classloaders.html
> - from several emails, if I put a reference to helper
> classes into "ServletContext", can I be sure that
> helper classes will not be unloaded? several emails
> give me this directions, I just want to make sure about
> it.
You are correct in your understanding here. The helper classes will not be
unloaded. But if you try to access the helper class(loaded from WAR file)
from the context after reload be prepared for a ClassCastException, unless
you use it as an object only. This is due to the fact the object was created
in a different namespace and after reloading, it is being casted to an
object of another namespace.
This will occur unless the container ClassLoader has taken steps to prevent
this (in tomcat I did manage to generate this exception).
> - a similar question is: with Servlet spec 2.2+, how to do
> the following:
> container uses a ClassLoader to load myServlet,
> then I modify myServlet and re-compile it, and after a while,
> the container finds the new version of myServlet and try to
> reload it. now I if I follow spec 2.2+ and don't make another
> ClassLoader to reload myServlet->I use the same ClassLoader
> to reload myServlet, now my questions: how to "force" this
> ClassLoader to unload the old version of myServlet, and reload
> the new version of myServlet ?
What 2.2+ is trying to mandate is that for one Web Application there will be
only one classloader. If there is a reload, then not only is the changed
servlet class reloaded, but the entire web application is reloaded using
another instance of the classloader.
Regds,
Gokul
>
>
> Thanks in advance! :-)
>
> Bo
> Jan.25, 2001
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html