cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: JNDI in cocoon (related to ClassLoader issues)
Date Tue, 11 Jun 2002 20:24:01 GMT
Geoff Howard wrote:

>Great.  I'll proceed with a light jndi impl, since most jms vendors provide
>one.  This ought to be a useful one for the archives.
>>-----Original Message-----
>>From: David Haraburda []
>>Sent: Tuesday, June 11, 2002 2:03 AM
>>Subject: Re: JNDI in cocoon (related to ClassLoader issues)
>>Hi Geoff,
>>Here's the deal:
>>Jakarta Tomcat, from version 4.0 and on, provides an in-memory Environment Naming
Context (ENC).  To enlist an object into this ENC, you configure it in server.xml, and then
in your web application's web.xml file.  Tomcat keeps a seperate ENC for each web application
context (note that a web app context is different from a naming context).
>>Additionally, each web application has a seperate instance of Tomcat's WebAppClassloader.
 The way Tomcat keeps track of each of these ENC's is by mapping them to each Thread's ContextClassLoader
-- when this association is made at startup, the appropriate ENC's are mapped to the appropriate
WebappClassLoaders.  When Cocoon is initialized however, the ContextClassLoader is overridden.
 Thus, when a lookup is attempted (or even an attempt to get the InitialContext), it fails,
because it can't find an ENC mapped to Cocoon's RepositoryClassLoader.
>>I submitted a patch to Tomcat, and from version 4.1 on, Tomcat looks for an ENC by
checking the ContextClassLoader, and then searching up through the classloader heirarchy,
so it will work that way.  
>>However, the real problem is with Cocoon setting the ContextClassLoader when it shouldn't
be, and that is going to be fixed soon as well.

This is now fixed, but this problem is very likely to resurface with 
Cocoon blocks : if a block comes with its own jars, Cocoon will have to 
create a classloader for them and set it as the context classloader so 
that block-defined classes can be loaded correctly by Avalon.

Tomcat seems to be ok now by travelling up the classloader hierarchy, 
but what about other servlet containers ?


Sylvain Wallez
 Anyware Technologies                  Apache Cocoon 

To unsubscribe, e-mail:
For additional commands, email:

View raw message