cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Compiling with Servlet spec 2.3 classloading
Date Wed, 20 Nov 2002 14:28:18 GMT
Nicola Ken Barozzi wrote:

> Stefano Mazzocchi wrote:
>> wrote:
>>> To the developers
>>> I've created a Pizza Compiler for Cocoon that uses the ClassLoader 
>>> retrieved from ClassUtils.getClassLoader () instead of a classpath 
>>> consisting of jar files and classes directories when compiling java 
>>> files. I've posted a message in the Pizzacompiler discussion forum 
>>> asking if the pizza developers want my code.
>>> I'm posting this message to the cocoon-dev mailing list to follow up 
>>> on others earlier threads regarding compilers and classloading, for 
>>> example:
>>> I'm deploying cocoon in a Jboss/Jetty environment; and I've turned 
>>> off Java 2 ClassLoading in favour of Servlet Spec 2.3 ClassLoading. 
>>> I might be wrong, but the general difference between them two is:
>>> - in Java 2 classloading, the parent classloader is always asked 
>>> first, then a classloader tries to locate the class itself
>>> - in Servlet Spec 2.3 the webapp classloader tries to locate the 
>>> class in WEB-INF/lib, WEB-INF/classes or, when deployed in an 
>>> enterprise application, in the interfaces to the ejb-layer (which 
>>> are not found in any files within the webapp).
>>> The beauty (IMHO) of Servlet Spec 2.3 class loading is that you get 
>>> the Xalan/Xerces/whatever that you deploy with your application, and 
>>> _not_ the Xalan/Xerces/whatever is delivered by the JDK or deploy 
>>> environment - much less hazzle. With this classloading scheme I can 
>>> take an arbitrary JDK and expect to get the proper classes loaded. I 
>>> know there's the workaround with endorsed lib and such - but then I 
>>> have to keep my JDK as up to date as my app.
>>> The problem with Servlet Spec 2.3 is that the compiler cannot get 
>>> the interfaces in a neat .jar file and hence cannot load the 
>>> classes. I've not been able to find any freely available java 
>>> compiler that uses a ClassLoader when compiling. Therefore I've made 
>>> a alternate version of the Pizzac java compiler class for cocoon 
>>> that uses an alternate ClassReader class for Pizza. This combination 
>>> seems to work.
>>> If there's interest in my solution I'll post the files to the list.
> YEAH! :-D


>> You are my man, really. I love this.

Yep. This one of the main hacky-zones of the Cocoon code base. Solving 
this will be a major step forward, and will be most useful for blocks also !

Please keep us posted !


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

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

View raw message