3 Replies Latest reply on Feb 28, 2012 9:12 AM by Scott Marlow

    Hibernate AuditStrategy Problem

    Martin Reinhardt Newbie

      I've got a problem getting hibernate working on my app under AS 7.1. When trying to start the app I got the following error:

       

       

      09:14:43,427 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."app2.ear#app": org.jboss.msc.service.StartException in service jboss.persistenceunit."app2.ear#app": Failed to start service
                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: app] 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've found this issue: https://issues.jboss.org/browse/JBPAPP-7903  and try to set the property via hibernate.cfg.xml, but it doesn't work.

       

       

      ...
        <property name="hbm2ddl.auto">validate</property>
        <property name="jdbc.batch_size">0</property>
        <property name="hibernate.listeners.envers.autoRegister">false</property>
      
      ...
      

      Any ideas: