cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Compiling with Servlet spec 2.3 classloading
Date Wed, 20 Nov 2002 09:02:35 GMT
Gee, now I've been lurking about the cocoon mailing lists for years, 
posting small and easily ignorable questions - and now this reply; it's 
probably the first time I see: "You are my man, really. I love this." on this mailing list...
thanks Stefano - nice to know that I might be on 
the right path.

Actually I haven't patched pizza, just extended one of their classes ;-) I 
tried to compile pizza myself but ran into some troubles getting the 
bootstrap compiler for the pizza files up and running, and since extending 
their classes did the trick I didn't bother too much. As a side note: I 
kinda like the strongly typed hashtables of the pizza language (highly 
irrelevant for the classloading matter)

The code is actually written for my employer, but he has on more occasions 
agreed to let solutions sieve back to the open source community - and this 
thing is really small....

A small disclaimer: I haven't tested this beast thoroughly, but I know for 
sure that statements like "import java.util.logging.SocketHandler" and 
"import java.util.loggging.*" work equally well - which was one of my 
major concerns since all I have is a classloader (and not a jar-file) and 
hence I cannot list the contents of a package (I might be wrong on this). 
But it seems that the pizza compiler is doing *the right thing* (tm) and 
scanning all star-imports for classes not explicitly imported.

First of all a big thank you to the Pizza people for creating the compiler 
that makes my small addon possible - as written I've posted a message on 
the pizzacompiler discussion forum, asking whether they would like to add 
my stuff,, 
but no reply yet - apparently not everybody is as eager about classloding 
compilers as cocoon folkes. I will immediately send of an email to the 
developers asking if they could accept my stuff. In the mean time please 
copy my stuff if you need it. Find attached a zip-file containing both 
source and compiled version - dump the neupart-pizza.jar into WEB-INF, 
edit cocoon.xconf to use the 
compiler instead of the normal Pizza compiler class - and off you go!

This version might not be the final say on the issue!

Jakob Dalsgaard
Vesterbrogade 149
1620 KĂžbenhavn V
Tlf.:   70 25 80 30
Fax.: 70 25 80 31

Stefano Mazzocchi <>
11/19/02 04:29 PM
Please respond to cocoon-dev

        Subject:        Re: Compiling with Servlet spec 2.3 classloading 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 
> I've posted a message in the Pizzacompiler discussion forum asking if 
> 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 
> 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 
> 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 
> 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_ 
> Xalan/Xerces/whatever is delivered by the JDK or deploy environment - 
> less hazzle. With this classloading scheme I can take an arbitrary JDK 
> 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 
> 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 
> been able to find any freely available java compiler that uses a 
> ClassLoader when compiling. Therefore I've made a alternate version of 
> 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.

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 

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.

Stefano Mazzocchi                               <>

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

View raw message