You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Geoff Howard <gh...@crosswalk.com> on 2002/06/10 16:52:41 UTC

JNDI in cocoon (related to ClassLoader issues)

Can someone clarify - is JNDI currently broken for cocoon on tomcat or is it
just cut off from tomcat's jndi?  I'm beginning work on a component which
will receive jms messages and will hold off if its going to be a battle just
to get the jndi lookup working.

Geoff Howard

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: JNDI in cocoon (related to ClassLoader issues)

Posted by David Haraburda <da...@haraburda.com>.
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.

But -- if you are using a different JNDI implementation (ie, not
Tomcat's) then you should be fine, ignore everything I just said. :-)

David

On Mon, 2002-06-10 at 09:52, Geoff Howard wrote:
> Can someone clarify - is JNDI currently broken for cocoon on tomcat or is it
> just cut off from tomcat's jndi?  I'm beginning work on a component which
> will receive jms messages and will hold off if its going to be a battle just
> to get the jndi lookup working.
> 
> Geoff Howard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org