cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject ClassLoading and Cocoon 2
Date Wed, 14 Feb 2001 05:40:59 GMT
Does anyone know how to selectively load classes from a parent ClassLoader?

I recently made Cocoon live inside it's own ClassLoader.  This is a good thing
as it protects us from a myriad of issues with IBM WebSphere and other Servlet
Containers that have wacky ClassLoaders.  However, the one thing it does not
protect us from is XML Parser conflicts.  If we can resolve against the Servlet
Engine's classes for things like javax.servlet.* and Enterprise applications,
but not anything else, then we are just about there.

One way is to explicitly handle the Parent ClassLoader separately from the
way the URLClassLoader handles it.  In other words, it always checks in the
current ClassLoader first (this does not seem to be happening), and then
it checks in the parent ClassLoader.

Another approach is to separate out the CocoonServlet classes from the main
Cocoon.jar and have all the specific Cocoon libraries in a non traditional
location--this may be easier to implement.

Example:
--------

WEB-INF/lib
         /avalon-api.jar
         /cocoon-servlet.jar

WEB-INF/cocoon-lib
         /Xerces_1_2_3.jar
         /cocoon.jar
....
And all the other libs

The approach would require making an Interface that would be in
cocoon-servlet.jar that would allow us to send requests to the
propper Cocoon class.  It would also force us to include the
ClassLoader in there.

This keeps Cocoon almost completely isolated, and enforces the
ClassLoader to be used.

Mime
View raw message