David Jencks wrote:

On Oct 24, 2008, at 11:13 AM, Joe Bohn wrote:


I've been playing around with grails and I encountered this exact same behavior Michael mentioned. Even with Gianny's recommended hidden classes I received the dom4j InvalidXPathException on the Tomcat Javaee5 assembly.

I was able to get a grails app working on a tomcat javaee5 assembly by adding just one more filter for the jaxen classes. So, my geroniom-web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2";>
   <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
       <moduleId>
           <groupId>yourGroupId</groupId>
           <artifactId>yourArtifactId</artifactId>
           <version>yourVersion</version>
           <type>war</type>
       </moduleId>
       <hidden-classes>
           <filter>org.jaxen</filter>
           <filter>org.springframework</filter>
           <filter>org.apache.cxf</filter>
           <filter>org.apache.commons</filter>
       </hidden-classes>
   </environment>
   <context-root>/yourContextPath/</context-root>
</web-app>

BTW, it is true that you can deploy a grails app into either minimal assembly without any hidden-class filters in the deployment plan. The additional libraries in the javaee5 assemblies make the filters necessary. Apparently there are some classloader differences between the Jetty and Tomcat assemblies that make the jaxen addition necessary when deploying to a Tomcat Javaee5 server.

It would be nice to figure out what the differences are. My first guess would be myfaces, my second some web services bit. I think that a ModuleBuilderExtension must be adding more dependencies for no good reason. It would be even better to fix this.


I think your second guess is the right one. A little more investigation revealed that the only real hidden-classes entries needed are as follows:
- springframework  - when installing in a javaee5 jetty assembly
- jaxen - when installing in a javaee5 tomcat assembly

That's because our axis2 module includes a dependency on jaxen and our cxf module includes a dependency on spring.

I'm now experimenting to see if these dependencies are really necessary. If they are, then the next step is to recall how to exclude these dependencies from the default-environment when being processed by the axis2 and cxf builders.

Joe




michaelg wrote:
I am writing an article for IBM developerWorks on using Grails and Geronimo together. However, I am unable to deploy a Grails WAR to Geronimo. I first tried it with Geronimo 2.1.1 with Jetty. The error I got was a
NoClassDefFound for org.apache.commons.fileupload.FileItemFactory. This
class is the Geronimo repository, and is also included with the Grails war. It's the same version for both. Next I tried it with Geronimo 2.1.1 with Tomcat. This time I got a dom4j InvalidXPathException. Next I tried the Little G distribution. It worked perfectly. I had also
tried standalone Tomcat with success as well, so I guess this should not
have been too surprising.
Obviously I have to point a finger at Grails or Geronimo, and since it works
fine on Tomcat or Little G, I am pointing the finger at Geronimo. The
Geronimo/Jetty error sure smelled like a class loader problem, but I have no
clue on the Geronimo/Tomcat. Note, in all cases I included a Geronimo
deployment plan inside the WAR (/WEB-INF/geronimo-web.xml) Any ideas/advice is greatly appreciated.




Reply via email to