RE: WEB-INF/classes, WEB-INF/lib

2002-10-14 Thread Scott Purcell

It works on my tomcat on NT. We use a lot of jars, but it it someties hard to 
uncompress and compress the jars with changes, so I just put the updated class in the 
classes dir and all works out well. When we go to production, I just jar them all back.



Scott

-Original Message-
From: Frank Liu [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 3:04 PM
To: [EMAIL PROTECTED]
Subject: WEB-INF/classes, WEB-INF/lib



Is it true that WEB-INF/classes overrides WEB-INF/lib in the classpath?
I have a binary jar file in WEB-INF/lib and need to overwrite on class
in the jar file, can you just put my class in the WEB-INF/classes and
tomcat will take care of it automatically?

Frank



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: WEB-INF/classes, WEB-INF/lib

2002-10-14 Thread Will Hartung


- Original Message -
From: Craig R. McClanahan [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, October 14, 2002 2:11 PM
Subject: RE: WEB-INF/classes, WEB-INF/lib




 On Mon, 14 Oct 2002, Scott Purcell wrote:

  It works on my tomcat on NT. We use a lot of jars, but it it someties
  hard to uncompress and compress the jars with changes, so I just put the
  updated class in the classes dir and all works out well. When we go to
  production, I just jar them all back.

 Containers that follow the servlet spec's requirements will load classes
 from /WEB-INF/classes before they look at the JAR files in
 /WEB-INF/lib.  [Section 9.5, last sentence before 9.5.1 starts].

Do they do this on a class level, or on a package level. So, from what I see
hear, patching a WEB-INF/lib JAR file with a overriding class in the
WEB-INF/classes directory will work as anticipated?

I never know how much caching of lookup Java is allowed to do with class
lookups, or whether it does any at all (though I do assume it caches the
directories/JARs when first visited, and does not look at those again, but
perhaps that's a bad assumption).

Regards,

Will Hartung
([EMAIL PROTECTED])




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: WEB-INF/classes, WEB-INF/lib

2002-10-14 Thread Craig R. McClanahan

On Mon, 14 Oct 2002, Will Hartung wrote:

 Date: Mon, 14 Oct 2002 14:30:40 -0700
 From: Will Hartung [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Re: WEB-INF/classes, WEB-INF/lib


 - Original Message -
 From: Craig R. McClanahan [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Monday, October 14, 2002 2:11 PM
 Subject: RE: WEB-INF/classes, WEB-INF/lib


 
 
  On Mon, 14 Oct 2002, Scott Purcell wrote:
 
   It works on my tomcat on NT. We use a lot of jars, but it it someties
   hard to uncompress and compress the jars with changes, so I just put the
   updated class in the classes dir and all works out well. When we go to
   production, I just jar them all back.
 
  Containers that follow the servlet spec's requirements will load classes
  from /WEB-INF/classes before they look at the JAR files in
  /WEB-INF/lib.  [Section 9.5, last sentence before 9.5.1 starts].

 Do they do this on a class level, or on a package level. So, from what I see
 hear, patching a WEB-INF/lib JAR file with a overriding class in the
 WEB-INF/classes directory will work as anticipated?


It's done at a per-class (or per-resource if you've got embedded
resources) level, rather than per-package.

Incidentally, Tomcat implements the exact same algorithm for the shared
class loaders as well:

- Classes in $CATALINA_HOME/shared/classes override classes
  in JAR files under $CATALINA_HOME/shared/lib

- Classes in $CATALINA_HOME/common/classes override classes
  in JAR files under $CATALINA_HOME/common/lib.

 I never know how much caching of lookup Java is allowed to do with class
 lookups, or whether it does any at all (though I do assume it caches the
 directories/JARs when first visited, and does not look at those again, but
 perhaps that's a bad assumption).


The classes and resources themselves are cached only when they are loaded.
However, a related question is can I add new classes and resources
dynamically while the app is running, and have them recognized?  The
answer for Tomcat, if you're running unpacked, is yes - but ONLY until the
class has been loaded.  You can't use this technique to replace an already
loaded class, because Java gives us no mechanism to do that.

 Regards,

 Will Hartung
 ([EMAIL PROTECTED])


Craig


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]