7 Replies Latest reply on Jan 18, 2012 3:08 PM by Marek Novotny

    JBoss AS7 cannot find my persistence.xml

    David Robison Novice

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("TravelTimeEngine-DS");I am deploying a SAR file that contains a META-INF directory with a persistence.xml file. When the SAR deploys it finds the persistence.xml file and creates the persistemce unit

       

      20:56:00,582 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-4) HHH000204: Processing PersistenceUnitInfo [

          name: TravelTimeEngine-DS

          ...]

       

      However, when I go to get the persistence unit I get the following error

       

      20:56:08,102 INFO  [org.hibernate.ejb.Ejb3Configuration] (InirxCommunications-2) HHH000318: Could not find any META-INF/persistence.xml file in the classpath

      20:56:08,102 WARN  [com.orci.TravelTimeEngine.hibernate.utils.ThreadTransaction] (InirxCommunications-2) getSessionSafe: javax.persistence.PersistenceException: No Persistence provider for EntityManager named TravelTimeEngine-DS

      20:56:08,102 ERROR [stderr] (InirxCommunications-2) javax.persistence.PersistenceException: No Persistence provider for EntityManager named TravelTimeEngine-DS

       

      20:56:08,102 ERROR [stderr] (InirxCommunications-2)     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)

       

      This is how I am getting the persistence unit:

       

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("TravelTimeEngine-DS");

       

      Any idea what I might be doing wrong? Why it first finds the persistence.xml file but then fails to find it on the classpath?

      Thanks, David