• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not resolve a persistence unit in EAR

 
Dominik Müller
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi have a lots of problems while deploy my application

Glassfish: GlassFish v3 (build 74.2) (same on: GlassFish 3 (build 14))
JPA 2.0, EJB 3.0
JPA Provider: Hibernate


Error:
Exception while preparing the app : org.glassfish.deployment.common.DeploymentException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [xxx] in the scope of the module called [XXX-ear-0.0.1-SNAPSHOT#XXX-comp-firmenmgmt-0.0.1-SNAPSHOT.jar]. Please verify your application.

My Application is packed as an EAR-File:

ear
+ lib
-- some libs
-- pu.jar (with META-INF Folder - persistence.xml)
xxx-comp-firmenmgmt-0.0.1-SNAPSHOT.jar (with Entites and EJBs)
xxx-comp-projektmgmt-0.0.1-SNAPSHOT.jar (with Entites and EJBs)
+META-INF
-- application.xml

The References from my Beans look like
" @PersistenceContext(name = "xxx") "

my persistence.xml look like:


try a lots of different declarations and positions of the persistence.xml but nothing work
Hope somebody have any good idea

thanks a lot
Dom
 
Dominik Müller
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Problem in my case was:

I included a Utility-Library from ourself, which declares a "persistence.xml" too. So we have multiply persistence-units in the EAR-File which seems to make trouble with Glassfish.

To resolve the Problem i defined a reference in applications.xml of the ear file according to this blog entry: http://www.icanmakeit.de/2008/10/01/could-not-resolve-a-persistence-unit-corresponding-to-the-persistence-context-ref-name/

Problem resolved and two days lost ;) anyways..

Dom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic