You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2001/10/31 03:12:06 UTC
Re: adding custom classpaths to web applications
On Tue, 30 Oct 101, Christos Karras wrote:
> Date: Tue, 30 Oct 101 19:16:51 EST
> From: Christos Karras <ck...@capella.org>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> Christos Karras <ck...@capella.org>
> To: tomcat-user@jakarta.apache.org
> Subject: adding custom classpaths to web applications
>
> Under Tomcat 4, is there a way to add a class path to
> a specific <Context>, that the class loader would search
> in addition to $CATALINA_HOME/classes, $CATALINA_HOME/lib,
> WEB-INF/classes and WEB-INF/lib ?
>
There is no such configuration mechanism at the moment. Implementing
something like this would require adding another level in the class loader
hierarchy, which is feasible to do for yourself (if you're willing to pay
the small-but-real extra performance hit of checking one more class
loader).
The basic idea would be to do something like this:
* Modify org.apache.catalina.startup.Bootstrap to create yet another
class loader using the repositories that you want to partially share.
Make the parent of this new class loader the existing "shared" loader.
Do this once per "new" repository you want to create.
* Add a configuration mechanism to figure out which "new" class loader
should be associated with each web app, and call
context.setParentClassLoader() to configure this.
If it were up to me, however, I'd go for simplicity. Spend a couple of
hundred dollars on some extra memory, and just load the correct JAR files
into the correct /WEB-INF/lib directories for the apps that need the
particular versions. My time is too valuable to waste trying to keep the
configuration of something this complicated straight, even it if were
supported, and I imagine that yours is too :-).
Craig McClanahan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>