cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: question about jar conflicts/java class loading conflicts
Date Thu, 18 Nov 2004 17:57:40 GMT
Eric Bloch wrote:

> Hey there,
>
> I'm a developer on another Java open source project and I've noticed 
> that cocoon shares some similar problems with our project.
>
> In particular, delployments of our webapp see a variety of different 
> and sometimes _very_ difficult to understand class-loading conflicts 
> in different servlet containers.
>
> And we'd like to come to some real solution to avoid these in the 
> future.  I'm wondering if cocoon developers have any good advice here.
>
> FYI, we are actually considering re-building the java classes in 
> *every* external jar we'd put in our web app's WEB-INF directory and 
> name-spacing *every* external class with our namepsace, but this is 
> costly in terms of maintenance  and is non-trivial with code that does 
> reflection, etc...
>
> We've also considered writing our own class-loader but we think this 
> won't solve the problem (and could make it worse, in fact).


Actually, it writing your own classloader *does* solve the problem. 
Cocoon provided a so-called "paranoid" block providing a 
"ParanoidCocoonServlet". This servlet loads the Cocoon servlet (or any 
other servlet through a config in web.xml) in a ParanoidClassLoader that 
shields the webapp's classes from the upper-level classloaders.

Shielding means that classes and resources are always looked up _first_ 
in the webapp before delegating to the parent classloader. Up to now, 
this has always saved my life in crazy classloading environments ;-)

More info at http://wiki.apache.org/cocoon/EndorsedLibsProblem

You can also browse the source at 
http://svn.apache.org/viewcvs.cgi/cocoon/trunk/src/blocks/paranoid/

> ps... our project is described at http://openlaszlo.org


We know it, and are happy to see you here :-)

There was a discussion here when you went opensource and we'd love to 
have a "LaszloSerializer" in Cocoon. Actually, it's already partly done 
(see http://blog.reverycodes.com/archives/000032.html)

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message