tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Tomcat 6.0.x Classloader sequence
Date Fri, 16 Nov 2007 02:08:36 GMT

Even if I place the jarfiles in a common path, they will be loaded by the webapp classloader
right? Which means that each webapp would load the jars anew. 

The distinct webapps are taking up a lot of heapspace and affecting Tomcat.
I would like to load the common jarfiles using commons classloader and yet not
mix the jarfiles with the "system" libraries in ${CATALINA_BASE}/lib.

Is it possible for me to instruct commons classloader to load from another
directory parallel to ${CATALINA_BASE}/lib?



 -------------- Original message ----------------------
From: "Caldarale, Charles R" <>
> > From: Caldarale, Charles R [] 
> > Subject: RE: Tomcat 6.0.x Classloader sequence
> > 
> > > Is it possible for me to configure the webapp class 
> > > loaders to load classes from a path common to multiple
> > > webapps before loading from the webapp itself?
> >
> > Browsing through the Tomcat source does turn up something called
> > VirtualWebappLoader; the comments therein indicate this is intended to
> > provide what you want.
> > 
> > I couldn't actually get it to work, but it is intriguing...
> With a little more playing around, I did get it to work.  Your webapps
> will need a <Context> similar to the following:
> <Context>
>   <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
>           virtualClasspath="C:/dir/classes"/>
> </Context>
> I assume if you put this in conf/context.xml, it will apply to all
> webapps.  Multiple locations can be given in the virtualClasspath
> attribute by separating them with semicolons; each jar must be specified
> separately.
> Using the MBeans tab of JConsole, you can see the paths used by each
> individual classloader; look in the Catalina -> Loader -> <appname> ->
> <hostname> -> Attributes for classpath.
>  - Chuck
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message