Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3291

EnversIntegrator is always detected by default while initializing Serviceregistry using Native Hibernate API causing a MappingException even when Envers is not used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.1.0.CR1
    • JPA / Hibernate, Test Suite
    • None
    • Hide

      Set
      configuration.setProperty("hibernate.listeners.envers.autoRegister", "false");

      Show
      Set configuration.setProperty("hibernate.listeners.envers.autoRegister", "false");

      Please find the hibernate native api tests located at :

      https://github.com/madhumita12/jboss-as/tree/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate

      The tests are working fine with a workaround I have applied to them,hence I would like to request you to run the HibernateNativeAPITransactionTestCase locally to see the issue I have been mentioning before.

      Also , please comment the workaround as follows before running the test in order to hit around the issue:
      In file SFSBHibernateTransaction please comment:

      // configuration.setProperty("hibernate.listeners.envers.autoRegister", "false");

      I am simply initialising BootstrapServiceRegistryBuilder and then passing the configuration properties to it to initialize the ServiceRegistry.
      I am not using any AuditListner or @Audited anywhere in my configuration/code.
      However when I initialize ServiceRegistry it by default AUTORegisters/detects the EnversIntegrator which tries to initialise AuditListner via Auditconfiguration and crashes.
      The workaround to this is to set the AUTO_REGISTER in EnversIntegrator to false as above.

      Stacktrace:

      ... 139 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:295) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]
      at org.jboss.as.test.integration.hibernate.SFSBHibernateTransaction.setupConfig(SFSBHibernateTransaction.java:81) [beans.jar:]

            shaozliu Strong Liu(刘少壮) (Inactive)
            madhumita12_jira Madhumita Sadhukhan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: