Charles,

Thanks for your patient responses. Unfortunately, the "shared classloader" does 
not
work either. This is in summary what I am trying to do: I have 3 webapp 
contexts that
use a number of commons libraries (say, digester, betwixt, beanutils). I do not 
want to
pack these jarfiles in each webapp, as it makes the warfiles unwieldy. Hence I 
want the
deployment structure:

         (CATALINA_HOME
               (mycommonlibs)
               (webapps
                      (webapp1)
                      (webapp2)
                      (webapp3)
               )
         )

I merely want the webapp classloader of each webapp1 to load classes not only 
from WEB-INF/{classes|lib}
but also from ${CATALINA_HOME}/mycommonlib. That is, I am willing to load each 
common jar
distinctly in each webapp and pay the price in terms of memory for the 
duplicate loads. I merely
want to co-locate the common jarfiles in a common directory.

Now, when I opt to use the shared classloader with the following entry in
catalina.properties:

      ##  catalina.properties::
      shared.loader=${catalina.home}/myapplib,${catalina.home}/myapplib/*.jar

it turns out that the classes in ${catalina.home}/myapplib/*.jar are loaded by 
StandardClassLoader (parent of WebappClassLoader) while the libraries in
webapp?/WEB-INF/{classes|lib} are loaded by WebappClassLoader. This causes
strange errors with classes not being found or, worse still, methods not being 
found.

For instance, I have placed commons-digester in ${catalina.home}/myapplib/.
I have an XML file in webapp3 which is parsed into JavaBeans which are defined 
in
webapp3/WEB-INF/lib/foo.jar.

With the catalina.properties specified as above, it turns out that digester
is loaded by the StandardClassLoader while foo.jar is loaded by 
WebappClassLoader:
(I am printing the class loader lineage of a bean):

    2008-01-16 11:43:37.0522 INFO  Bean:foo, class:Foo  loaded by:
             org.apache.catalina.loader.WebappClassLoader
               org.apache.catalina.loader.StandardClassLoader
                  org.apache.catalina.loader.StandardClassLoader
                     sun.misc.Launcher$AppClassLoader
                        sun.misc.Launcher$ExtClassLoader

    2008-01-16 11:43:37.0412 INFO  Bean:Digester, 
class:org.apache.commons.digester.Digester, loaded by:
             org.apache.catalina.loader.StandardClassLoader
                org.apache.catalina.loader.StandardClassLoader
                   sun.misc.Launcher$AppClassLoader
                       sun.misc.Launcher$ExtClassLoader

Hence while digester is loaded by StandardClassLoader, the beans that Digester 
must 
instantiate are loaded by WebappClassLoader. 

Since StandardClassLoader is the parent of WebappClassLoader, per the 
delegation model,
digester will fail to find the application beans it needs.

I need the libs in myapplib/ loaded by the webappclass loader of each webapp 
context.
What is the simplest way to accomplish this?

Regards,

/U
--

 -------------- Original message ----------------------
From: "Caldarale, Charles R" <[EMAIL PROTECTED]>
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to