cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <>
Subject Re: Compiling with Servlet spec 2.3 classloading
Date Tue, 19 Nov 2002 15:40:27 GMT

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.


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

Stefano, you once said that probably you would have had to make your own 
compiler to get round this problem, so does this mean that you're not 
going to do it anymore?  ;-)

> Let's throw away normal class-path based classloading as soon as possible.
> THIS problem has been the major portability issue for cocoon on 
> different platforms (like early WebSphere or WebLogic, for example) for 
> dynamically compiled stuff (like sitemap in 2.0.x and XSP in all versions).
> Now, as much as I like this, I don't want Cocoon to maintain a forked 
> version of Pizza. Have you given back your patches to the pizza folks or 
> this is just your own personal release for it?
> In any case, we *really* need to incorporate this so we must find a 
> proper way.


Nicola Ken Barozzi         
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)

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

View raw message