jpadeploymentejb-3.0classnotfoundexceptionglassfish-2.x

Separate jar for EJB3 Entity classes


When I separate my EJB3 entities (annotated with @Entity) from my EJB Module and put them in a separate jar file, where should my Persistence.xml file go, in my EJB module or in my entities.jar? And how should I deploy the entities.jar file? It's not an EJB module since it doesn't have any EJBs, just JPA entities.

I'm using Glassfish and what I did was, put the entities.jar in the /lib/applibs directory and when deploying the EJB Module, i declared that it uses that library.

But the deployment fails with:

Internal Exception: java.lang.ClassNotFoundException: com.pedra.Role
javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: predeploy for PersistenceUnit [SignonPU] failed.
Internal Exception: Exception [TOPLINK-30007] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while loading class: com.pedra.Role to check whether it implements @Entity, @Embeddable, or @MappedSuperclass.
Internal Exception: java.lang.ClassNotFoundException: com.pedra.Role

So why can't this class be found when it is in that entities.jar library?


Solution

  • It looks like something that should be working.

    I'd say: