You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by um...@comcast.net on 2008/01/15 21:22:04 UTC

Problems with VirtualWebappLoader (Was RE: Tomcat 6.0.x Classloader sequence)

Env: JRE1.6, Tomcat 6.0.14

Following on an earlier thread: I am trying to place the libraries common
to a number of webapp contexts in a common directory (${catalina.home}/myapplib)
and configure the VirtualWebappLoader with the list of jarfiles for loading by
each webapp context.

My problem is that I need to specify the path to the libraries in a platform-independent manner:
when I attempt

    <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
          virtualClasspath="/home/tomcat/myapplib/activation-1.0.2.jar:..."
    />

it works perfectly. When I however do the following (in an attempt to make it
platform- and location-independent specification), it fails  to find the libraries:

   <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
          virtualClasspath="${catalina.home}/dmslib/activation-1.0.2.jar; ..."
   />

There are three platform/location specific elements here which I need to get rid of:
   1) catalina.home
   2) path separator: '\' vs '/' for windoze and *nix)
   3) field separate: ';' vs ':' for windoze and *nix)

Is there a way to do this? 
Thanks,

/U

 -------------- Original message ----------------------
From: "Caldarale, Charles R" <Ch...@unisys.com>
> > From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
> > 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
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> 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: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problems with VirtualWebappLoader (Was RE: Tomcat 6.0.x Classloader sequence)

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: uma_rk@comcast.net [mailto:uma_rk@comcast.net] 
> Subject: Problems with VirtualWebappLoader (Was RE: Tomcat 
> 6.0.x Classloader sequence)
> 
> Following on an earlier thread: I am trying to place 
> the libraries common to a number of webapp contexts
> in a common directory (${catalina.home}/myapplib)

Have you thought about just configuring this in the shared classloader
in conf/catalina.properties?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
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: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org