Vadim Gritsenko wrote:
Sylvain Wallez wrote:

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.


Oh good. You fixed all the problems I was having.


-- "You know the world is going crazy when the best rapper is a white guy, the best golfer is a black guy, The Swiss hold the America's Cup, France is accusing the US of arrogance, and Germany doesn't want to go to war. And the 3 most powerful men in America are named 'Bush', 'Dick', and 'Colon' (sic)".

-----Chris Rock



Reply via email to