0 Replies Latest reply on Apr 12, 2013 9:41 AM by Fabiano Frizzo

    JBoss eap 6.1 Hibernate 4.2.0 Spring 3

    Fabiano Frizzo Newbie

      Hi Guys

       

      I have a problem with this setup.

      I get the following error.

      I try a several changes on my configurations but in any cases that work correctly.

       

      10:34:34,312 ERROR [org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl] (http-/127.0.0.1:8080-2) HHH000346: Error during managed flush [Unable to create revision because of non-active transaction]
      10:34:34,312 WARN  [com.arjuna.ats.arjuna] (http-/127.0.0.1:8080-2) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff0a000002:1b76b395:51680d43:1a, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@41041c61 >: org.hibernate.envers.exception.AuditException: Unable to create revision because of non-active transaction
                at org.hibernate.envers.event.BaseEnversEventListener.checkIfTransactionInProgress(BaseEnversEventListener.java:134) [hibernate-envers-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.envers.event.EnversPostUpdateEventListenerImpl.onPostUpdate(EnversPostUpdateEventListenerImpl.java:49) [hibernate-envers-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.action.internal.EntityUpdateAction.postUpdate(EntityUpdateAction.java:248) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:205) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:328) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1233) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:403) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:112) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.2.0.Final.jar:4.2.0.Final]
                at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
                at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
                at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1011) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) [spring-aop-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at br.com.optimuslabs.service.core.CrudService$$EnhancerByCGLIB$$e11993ff.save(<generated>) [spring-core-3.2.2.RELEASE.jar:]
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_10]
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_10]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_10]
                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_10]
                at org.granite.messaging.service.ServiceInvocationContext.invoke(ServiceInvocationContext.java:71) [granite-core-2.3.2.GA.jar:]
                at org.granite.messaging.service.security.AbstractSecurityService.endAuthorization(AbstractSecurityService.java:77) [granite-core-2.3.2.GA.jar:]
                at org.granite.spring.security.SpringSecurity3Service.authorize(SpringSecurity3Service.java:263) [granite-spring-2.3.2.GA.jar:]
                at org.granite.messaging.service.ServiceInvoker.invoke(ServiceInvoker.java:214) [granite-core-2.3.2.GA.jar:]
                at org.granite.messaging.amf.process.AMF3MessageProcessor.processRemotingMessage(AMF3MessageProcessor.java:136) [granite-core-2.3.2.GA.jar:]
                at org.granite.messaging.amf.process.AMF3MessageProcessor.process(AMF3MessageProcessor.java:59) [granite-core-2.3.2.GA.jar:]
                at org.granite.messaging.amf.process.AMF0MessageProcessor.process(AMF0MessageProcessor.java:78) [granite-core-2.3.2.GA.jar:]
                at org.granite.messaging.webapp.AMFEndpoint.service(AMFEndpoint.java:71) [granite-core-2.3.2.GA.jar:]
                at org.granite.spring.FlexFilter.handle(FlexFilter.java:245) [granite-spring-2.3.2.GA.jar:]
                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) [spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) [spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) [spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) [spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
                at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) [spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE]
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_10]
      
      

       

      This is my currenct configuration

       

       

                      Configuration conf = new Configuration();
      
        //Connection
                          conf.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL82Dialect");
                          conf.setProperty("hibernate.connection.release_mode", "after_statement");
                          conf.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver");
                          conf.setProperty("hibernate.connection.datasource", "java:jboss/datasource/optimuslabsDS");
        
                          conf.setProperty("hibernate.format_sql", hibernateFormatSql.toString());
                          conf.setProperty("hibernate.show_sql", hibernateShowSql.toString());
        
                          conf.setProperty("hibernate.default_schema", schemaName);
        
        //Envers
                          conf.setProperty("org.hibernate.envers.default_schema",  schemaName + "_aud");
                          conf.setProperty("hibernate.listeners.envers.autoRegister",  "true");
        
        //Cache
                          conf.setProperty("hibernate.cache.use_query_cache", "true");
                          conf.setProperty("hibernate.cache.use_second_level_cache", "true");
                          conf.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.infinispan.JndiInfinispanRegionFactory");
                          conf.setProperty("hibernate.cache.infinispan.cachemanager", "java:jboss/infinispan/hibernate");
                          conf.setProperty("hibernate.cache.infinispan.use_synchronization", "false");
                          conf.setProperty("hibernate.cache.infinispan.statistics", "true");
        
        //Transactions
                          conf.setProperty("hibernate.transaction.factory_class", "org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory");
                          conf.setProperty("hibernate.transaction.jta.platform", "org.hibernate.service.jta.plataform.internal.JBossAppServerJtaPlatform");
                          conf.setProperty("hibernate.transaction.flush_before_completion", "true");
                          conf.setProperty("hibernate.current_session_context_class", "jta");
      
      
                      ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder();
        
                          serviceRegistryBuilder
                                    .applySetting(AvailableSettings.DIALECT, "org.hibernate.dialect.PostgreSQL82Dialect")
                                    .applySetting(AvailableSettings.RELEASE_CONNECTIONS, "after_statement")
                                    .applySetting(AvailableSettings.DRIVER, "org.postgresql.Driver")
                                    .applySetting(AvailableSettings.DATASOURCE, "java:jboss/datasource/optimuslabsDS")
                                    .applySetting(AvailableSettings.TRANSACTION_STRATEGY, "org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory")
                                    .applySetting(AvailableSettings.JTA_PLATFORM, "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform")
                                    .applySetting(AvailableSettings.FLUSH_BEFORE_COMPLETION, "true")
                                    .applySetting(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "jta");
        
                          serviceRegistryBuilder
                                    .applySetting(AvailableSettings.TRANSACTION_STRATEGY, "org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory")
                                    .applySetting(AvailableSettings.JTA_PLATFORM, "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform");
      
                      ServiceRegistry serviceRegistry = getServiceRegistryBuilder().buildServiceRegistry();
                          SessionFactory sessionFactory = conf.buildSessionFactory(serviceRegistry);
      
      
      

       

      I can't see I wrong configuration.

      Someone have the same problem?

       

      Many Thanks