Hi,
I have just filed a bug with Glassfish related to class loading and EAR packaging:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=11671
It has the following problem description (hope it will be helpful for others encountering the same issue):
I am packaging a typical Enterprise Application as follows in an EAR file:
MyEAR/
- META-INF/application.xml
- MyWEB.war (web archive with one Servlet)
- MyEJB.jar (ejb archive with one SLSB)
- lib/MyJPA.jar (JPA 2.0 library)
The JPA library contains an entity class that is annotated with an
@EntityListener on the class level. The listener is supposed to set an UUID
property of the entity before it gets persisted (method in listener class
annotated with @PrePersist).
I deploy the MyEAR.ear to Glassfish v3 (build 74.2) and start the Servlet, which
calls the SLSB. The SLSB creates a new entity instance and uses the
EntityManager to persist it. My code checks for correct setting of the UUID via
the EntityListener. However, the property was not set after otherwise successful
persist operation.
Inspecting the GF log file (attached) reveals that my entity listener class
(UuidGeneratorListener) was not found in the class loader hierarchy.
Besides the class loader error (LDR5206) in the log file, I would expect the
EntityManager.persist() operation to fail instead of silently ignoring this error.
The same application works fine if packaged and deployed as WAR archive (MyEJB.jar and MyJPA.jar inside WEB-INF/lib).
[Message sent by forum member 'jhasenbe' (jhasenbe_at_gmx.net)]
http://forums.java.net/jive/thread.jspa?messageID=391264