tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Xu ...@cybershop.ca>
Subject Re: Tomcat class loader
Date Tue, 27 Feb 2001 18:49:30 GMT
uthay wrote:

> Thx Jim
>
> I tried that.
> I also want to bring some other thing I read recently.
> It states that although tomcat supports class reloading on updation it is
> still not supported to those classes that are not servlets.
> What does that supposed to mean?
> [...]

> [...]
> >
> > Uthay - I was having the same problem. See my post yesterday under subject
> > JSP caching.
> >
> > The problem is that your WEB-INF directory is probably in your CLASSPATH
> > when you start Tomcat - see the FAQ - it won't reload classes in your
> > CLASSPATH
> >
> > There is a question/answer in the FAQ re: this - I feel dumb about it. Now
> > you can too :)
> >
> > Good luck.
> >
> > Jim
> [...]

> [...]
> > >From: "uthay"
> > >Subject:  Tomcat class loader
> > >Date:  Tue, 27 Feb 2001 13:15:44 -0000
> > >
> > > It was stated in the tomcat installation instructions that tomcat will
> > > reload any servelet or jsp file if the file is changed.
> > > I am using a package through a servlet. Although I have modified the
> > > package, tomcat is refusing to load the new classes and holding onto the
> > > older ones.
> > > May be its because they are not servlets??????
> > > Is there anyway of solving this.
> > > Does tomcat follow a different class loading mechanism for classes
> > >that are not servlets. (classes in WEB-INF)?
> [...]

Hi :-)   I am not sure, the following is from my work with
jakarta-tomcat-4.0-b1(standalone, JDK1.3,  winnt40), I post
here as a reference:

   * in myapp(one special webapp):

     - all MyServlet(Servlet class) in WEB-INF/classes
     - all MyHelper(Helper class, class-style)  in WEB-INF/classes
     - all MyHelper(Helper class, jar-style)  in WEB-INF/lib
     are loaded by the same(OnlyOne) classloader;
     and if ANY of them is modified,  then:
     -  after a while(for example, 0.x second to several seconds)
            AND
     - get a client-requesting which is to any servlet definition of
            any MyServlet in myapp
     then:
     -  the old OnlyOne classloader is destroied ; a new OnlyOne
        classloader is made.
      - at least, that MyServlet class which is belong to that servlet
         definition which is invoked is loaded ;
         and an instance of this loaded class is made for that servlet
         definition which is being requested;
         and all MyHelper need by the loaded class  is loaded by
         the same OnlyOne classloader.
      - just from my work,  I didn't find any servlet definition which
        has "<load-on-startup></load-on-startup>" can be "started"
        at this moment(reloading) -> IF  this servlet definition doesn't
        get a client-requesting.
      -after this moment, the new OnlyOne classloader begins to work,
        just like the old one.
      - now because the old classloader is not there, so if we put some
        object which is loaded by the old classloader into ServletContext
         as a Attribute,  now perhaps this object will not have its Class
         object( it is like a tree without root :-)  ), but now this object
         also can not be GCed-> it has a reference in ServletContext ,
         so now perhaps our servlet code will meet a error.

* and I also have a question about the "Shared classloader"
   - I find when jakarta-tomcat-4.0-b1 starts, all my CLASSPATH
     is lost -> jakarta-tomcat-4.0-b1 disable all "custom CLASSPATH",
     is that right?   if so, I guess it means I can not use some "System
     classloader", am I right?

   - so now I try to find a classloader within jakarta-tomcat-4.0-b1,
     but because the classloader "inside every wepapp" will be
     destroied/re-made,  so sometimes I want to use the "Shared
     classloader" to load some MyHelper which need to "live for
     long time", but just from my work, no matter I put MyHelper
     (jar style) in:
     %  TOMCAT_HOME/lib
     %  TOMCAT_HOME/classes

     I can not load MyHelper in MyServlet, and I got the following
     in browser:
     HTTP Status 500 - /myServletFolder0/servlet/MyServlet
     The server encountered an internal error
     (/myServletFolder0/servlet/MyServlet)
     that prevented it from fulfilling this request.

     so:
     -  can anybody do the above with jakarta-tomcat-4.0-b1?
     -  can anybody do the above with 3.2.1 or other version?

     thanks very much in advance!  if somebody can give me direction
     about how to do it, I will send you a good 2CD->" many signers
     tribute to Bob Dylan"  it is very good! :-) Stevie Wonder sings
     a song named "blow in the wind", and I think he sings this song
     much better than Bob Dylan himself!       //hahahahaha :-) :-)


Bo
Feb.27, 2001



Mime
View raw message