users@glassfish.java.net

GF 3.1.1 yet another classloading issue - JEE6 EAR packaging and MANIFEST.FM

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Tue, 29 Nov 2011 11:13:39 +0100

Hi experts,

classloading and 'portable JEE application' seems to be very challenging in
GF 3.1.1

I have a (3rd party) enterprise app with layout

META-INF/application.xml
ejb1.jar
|_ META-INF/MANIFEST.FM (Class-Path: lib/lib1.jar lib/lib2.jar classes)

ejb2.jar
|_META-INF/MANIFEST.FM (Class-Path: lib/lib1.jar lib/lib3.jar classes)

lib/lib1.jar
lib/lib2.jar
lib/lib3.jar
classes/<package-structure>

A 'NoClassDefFoundError' is raised

java.lang.NoClassDefFoundError: <class-from-classes-directory>
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at
com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader
.java:756)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:410)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:410)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at <method-of-class-from-ejb1.jar>


As far as I interpret chapter 'EE.8' of JEE 6 specification I packaged the
appliation correctly.

Could it be that GF 3.1.1 does not honour directories mentioned in
MANIFEST.FM ?

Section 8.2.1 states ...

"The Java EE deployment tools must process all such referenced files and
directories when processing a Java EE module."

Thanks for any pointers.

-Bernhard
-- 
IT-Consulting Bernhard Thalmayr
- Painstaking Minds -
83620 Vagen (Munich area)
Germany