0

With glassfish, my persistence.xml is not loaded.

my.ear
    META-INF/persistence.xml
    lib/entities.jar <!-- no persistence.xml here -->

persistence.xml contains

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
  <persistence-unit name="xxxPU" transaction-type="JTA">
    <jta-data-source>jdbc/xxxDS</jta-data-source>
    <jar-file>lib/entities.jar</jar-file>
  </persistence-unit>
</persistence>

successfully deployed but, I got.

Unable to retrieve EntityManagerFactory for unitName xxxPU

Thanks.

Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
  • 1
    How does your jpaEntityManagerFactory bean look like? – heldt Apr 03 '12 at 05:44
  • I just found that placing the persistence.xml in META-INF/ of an EAR is not a standard way. Can anybody confirm this? I created a persistence archive and it works. – Jin Kwon Apr 03 '12 at 07:48

1 Answers1

1

I would try to create a .jar file which would contain the persistence.xml file. Then place the jar file in the lib folder. More info here

Community
  • 1
  • 1