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]