tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: adding custom classpaths to web applications
Date Wed, 31 Oct 2001 02:12:06 GMT

On Tue, 30 Oct 101, Christos Karras wrote:

> Date: Tue, 30 Oct 101 19:16:51 EST
> From: Christos Karras <>
> Reply-To: Tomcat Users List <>,
>      Christos Karras <>
> To:
> 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

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:   <>
For additional commands, e-mail: <>

View raw message