cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject The end of the infamous endorsed libs problem : ParanoidCocoonServlet now really paranoid
Date Tue, 03 Jun 2003 13:28:38 GMT
Hi all,

Short story : once again, I've hit the famous endorsed library problem. 
So as usual I copied Cocoon's Xalan and Xerces to 
tomcat/common/endorsed, but unfortunately this broke another application 
that was running in the same Tomcat.

Damn. How to solve this ? Install another Tomcat ? Yeah, it will work, 
but will add yet-another-JVM to the server, which I wanted to avoid. So, 
I decided to use ParanoidCocoonServlet, and discovered that it was 
actually not paranoid at all because it was not using the 
ParanoidClassLoader it was supposed to use :-(

So I refactored a bit all our servlets and now ParanoidCocoonServlet is 
_really_ paranoid. This means, that its classloader will _always_ try to 
load classes and resources first from WEB-INF/lib and WEB-INF/classes, 
ignoring any similar classes existing in the parent classloader. Xalan, 
Xerces, etc are now really immune to whatever version of the same 
library can exist either in the JDK or in the servlet engine.

Such a strong shielding can have some drawbacks, however : if a class is 
given by the servlet engine (e.g. a JNDI context) and the same class 
exists in the webapp libs (e.g. in jndi.jar), then you're very likely to 
get a ClassCastException. This is likely to happen mostly with standard 
APIs, and the solution is then to remove the offending library from your 
WEB-INF/lib.

Enjoy,
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