cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiron Liddle <>
Subject Re: [C2] ClassLoader bug in serializers (fwd)
Date Fri, 27 Jul 2001 08:01:07 GMT

I've figured out what the problem is with the class loader.
It consists of three problem areas. One in Cocoon, one in Tomcat and
another with the combination. (simple so far). This may only be relevant
with the cocoon - tomcat combination.

The bottom line is that tomcat has a bug that needs to be fixed and I think
cocoon needs to think about some things.

- Cocoon has its own class loader. This class loader adds all the classes
(jars) in the WEB-INF directory. This is fine except it puts the current
class loader (that loaded cocoon) as the parent class loader. This parent
is the tomcat class loader and it gets the first go at loading the classes.
This means that all the classes are really loaded with the tomcat class
loader. The cocoon class loader effectively does nothing.

- So when a class is loaded through the cocoon class loader, the class
loader of the class that is loaded becomes the tomcat class loader (not the
cocoon one). This means that any class then loaded by the previously loaded
class will only use the tomcat class loader.
If the cocoon class loader does not have the tomcat class loader as the
parent then it cannot work. Cocoon is initially loaded with tomcat. Then if
it attempts to load all new classes with the new class loader it gets class
cast exceptions as the classes are being loaded from two different class
loaders and are effectively different classes.

- Tomcat has its own class loader.
This class loader (I'm not exactly sure) I think has all the classes (jars)
in the current servlet context (with WEB-INF). It effectively does what the
cocoon class loader does (probably with some differences). This would be
fine and still work for us except the tomcat class loader has not
implemented the particular method that is being used to load the resources.

So cocoon is attempting to creat its own class loader context, which
doesn't work.
Tomcat has its own class loader which only partly works.

So if you can understand all of that good luck.


To unsubscribe, e-mail:
For additional commands, email:

View raw message