2 Replies Latest reply on Jun 1, 2012 7:37 AM by javamutu

    Unable to build EntityManagerFactory JPA + EJB in JBoss AS 7

    javamutu Newbie

      When I trying to use EJB 3.1 and JPA 2.0 in JBoss AS 7. I used EclipseLink Persistence Provider.

      When I deploy the application, I get the following error. How to configure the JPA 2.0 EclipseLink in JBoss AS 7?

       

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: YOMA] Unable to build EntityManagerFactory

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          ... 3 more

      Caused by: org.hibernate.MappingException: Unable to create AuditStrategy[org.hibernate.envers.strategy.DefaultAuditStrategy] instance.

          at org.hibernate.envers.configuration.AuditConfiguration.initializeAuditStrategy(AuditConfiguration.java:114)

          at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:101)

          at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:135)

          at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63)

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

          ... 9 more

       

       

      I alrady add the EclipseLink JPA module under JBOSS_HOME/modules/org/eclipse/persistence/Main. Version is eclipselink-2.3.1.jar.

       

      It is momodule.xml.

       

      <module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">

          <resources>

              <resource-root path="eclipselink-2.3.1.jar"/>

          </resources>

       

          <dependencies>

              <module name="asm.asm"/>

              <module name="javax.api"/>

              <module name="javax.persistence.api"/>

              <module name="javax.transaction.api"/>

              <module name="javax.validation.api"/>

              <module name="javax.xml.bind.api"/>

              <module name="org.antlr"/>

              <module name="org.apache.ant"/>

              <module name="org.apache.commons.collections"/>

              <module name="org.dom4j"/>

              <module name="org.javassist"/>

              <module name="org.jboss.logging"/>

          </dependencies>

      </module>

       

      It is persistence.xml

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0"

                   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">

        <persistence-unit name="YOMA" transaction-type="JTA">

              <jta-data-source>java:/jdbc/yomaDS</jta-data-source>

              <properties>

                  <property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence" />       

              </properties>

          </persistence-unit>

      </persistence>