cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Compiling with Servlet spec 2.3 classloading
Date Tue, 19 Nov 2002 07:51:03 GMT
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.

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

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

View raw message