3 Replies Latest reply on Oct 8, 2013 6:12 AM by Franck cdsosi

    HowTo : Configure jBPM console only for retrieving information? Commit / Rollback Issues...

    Franck cdsosi Newbie

      Hi community,

       

      I want to configure jBPM console to my requirements but I am facing problems since quite a long time that's why I am asking help from community

       

      My environment is :

      • jBPM 5.4.0.Final
      • JAS 7.1.1
      • JPA Persistence
      • mySQL database
      • Drools Spring for KnowledgeBase, Session, Handlers

       

      I have a Web application (war deployed inside JAS 7.1.1) which is handling several BPMN 2 processes. I must say that my web application is embedded jBPM runtime.

      This application uses a spring configuration file to configure knowledgebase, session, handler and so on. My business processes have some user task declared in (communication is established with jBPM Human Task API via HornetQ on port 5153 which is default configuration).

       

      I want to use jBPM console only to visualize special kind of information :

      • Process definitions
      • Currently running processes with Diagram and Variables
      • Personal Tasks of logged user

       

      To do that I have configured jBPM console in the following way :

      • make parameter jbpm.console.directory point to a local directory which contains my BPMN files (those included in my web application)
      • set users.properties and roles.properties to suit my requirements
        • => these two modified files have been made available
          • in jbpm-installer\jboss-as-7.1.1.Final\standalone\configuration
          • inside war jbpm-form-builder.war (WEB-INF\classes\)

       

      When logged into jBPM console it seems to work as expected but after visualizing some kind of information I am not able to complete user tasks from within my application (not inside jBPM console). I have commit / rollback issues (see complete log a bit further).

      Moreover when I try to start a new process, I also  get some issues (Unable to commit transaction: org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction) coming from the first error I think.

       

      My question how can I use jBPM console to my special requirements only for information retrieving? Is it possible with jBPM 5.4.0.Final?

       

      It seems that my problem is similar to :

       

      I must add that everything is working fine (process start, task start/ complete) if I do not use jBPM console.

       

      Any help on that specific problem would be appreciated !

       

      Kind regards

       

      15:31:37,206 WARN  [org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager] (Thread-131) Unable to commit transaction: org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction

          at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.convertException(ExtendedEntityManagerCreator.java:502) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:481) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:953) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:796) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:65) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:271) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler$1.run(GenericHTWorkItemHandler.java:239) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: javax.persistence.RollbackException: Error while committing the transaction

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:90) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:478) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          ... 11 more

      Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#64]

          at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1390) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1308) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:78) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 12 more

      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#64]

          at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3010) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2908) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3237) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:113) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:187) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 12 more

       

      15:31:37,447 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-131) Could not commit session: java.lang.RuntimeException: Unable to commit transaction

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:70) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:271) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler$1.run(GenericHTWorkItemHandler.java:239) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction

          at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.convertException(ExtendedEntityManagerCreator.java:502) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:481) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:953) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:796) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:65) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          ... 5 more

      Caused by: javax.persistence.RollbackException: Error while committing the transaction

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:90) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:478) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          ... 11 more

      Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#64]

          at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1390) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1308) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:78) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 12 more

      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#64]

          at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3010) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2908) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3237) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:113) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:187) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 12 more

       

      15:31:37,698 WARN  [org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager] (Thread-131) Unable to rollback transaction: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:271) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler$1.run(GenericHTWorkItemHandler.java:239) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

       

      15:31:37,759 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-131) Could not rollback: java.lang.RuntimeException: Unable to rollback transaction

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:85) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:271) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler$1.run(GenericHTWorkItemHandler.java:239) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          ... 6 more

       

      15:31:37,829 ERROR [stderr] (Thread-131) Exception in thread "Thread-131" java.lang.RuntimeException: Could not commit session or rollback

       

      15:31:37,834 ERROR [stderr] (Thread-131)     at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:406)

       

      15:31:37,841 ERROR [stderr] (Thread-131)     at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381)

       

      15:31:37,846 ERROR [stderr] (Thread-131)     at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

       

      15:31:37,853 ERROR [stderr] (Thread-131)     at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:271)

       

      15:31:37,860 ERROR [stderr] (Thread-131)     at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler$1.run(GenericHTWorkItemHandler.java:239)

       

      15:31:37,867 ERROR [stderr] (Thread-131)     at java.lang.Thread.run(Thread.java:722)

       

      15:31:37,870 ERROR [stderr] (Thread-131) Caused by: java.lang.RuntimeException: Unable to rollback transaction

       

      15:31:37,875 ERROR [stderr] (Thread-131)     at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:85)

       

      15:31:37,882 ERROR [stderr] (Thread-131)     at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402)

       

      15:31:37,888 ERROR [stderr] (Thread-131)     ... 5 more

       

      15:31:37,890 ERROR [stderr] (Thread-131) Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

       

      15:31:37,899 ERROR [stderr] (Thread-131)     at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817)

       

      15:31:37,906 ERROR [stderr] (Thread-131)     at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79)

       

      15:31:37,913 ERROR [stderr] (Thread-131)     ... 6 more

       

      15:31:39,197 WARN  [org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager] (Thread-123) Unable to commit transaction: org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction

          at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.convertException(ExtendedEntityManagerCreator.java:502) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:481) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:953) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:796) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:65) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getId(CommandBasedStatefulKnowledgeSession.java:119) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:228) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:204) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: javax.persistence.RollbackException: Error while committing the transaction

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:90) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:478) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          ... 13 more

      Caused by: java.lang.NullPointerException

          at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:192) [jbpm-persistence-jpa-5.4.0.Final.jar:5.4.0.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]

          at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:39) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:110) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:95) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:65) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:266) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:149) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:225) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 14 more

       

      15:31:39,444 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-123) Could not commit session: java.lang.RuntimeException: Unable to commit transaction

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:70) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getId(CommandBasedStatefulKnowledgeSession.java:119) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:228) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:204) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction

          at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.convertException(ExtendedEntityManagerCreator.java:502) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:481) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:953) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:796) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.commit(DroolsSpringTransactionManager.java:65) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          ... 7 more

      Caused by: javax.persistence.RollbackException: Error while committing the transaction

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:90) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:478) [spring-orm-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          ... 13 more

      Caused by: java.lang.NullPointerException

          at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:192) [jbpm-persistence-jpa-5.4.0.Final.jar:5.4.0.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]

          at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:39) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:110) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:95) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:65) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:266) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:149) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:225) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          ... 14 more

       

      15:31:39,695 WARN  [org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager] (Thread-123) Unable to rollback transaction: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getId(CommandBasedStatefulKnowledgeSession.java:119) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:228) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:204) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

       

      15:31:39,765 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-123) Could not rollback: java.lang.RuntimeException: Unable to rollback transaction

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:85) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getId(CommandBasedStatefulKnowledgeSession.java:119) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:228) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:204) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          ... 8 more

       

      15:31:39,845 ERROR [org.jbpm.task.service.hornetq.HornetQTaskClientConnector] (Thread-123) Client Exception with class class org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1 using port 5153: java.lang.RuntimeException: Could not commit session or rollback

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:406) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getId(CommandBasedStatefulKnowledgeSession.java:119) [drools-core-5.5.0.Final.jar:5.5.0.Final]

          at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:228) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:204) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

      Caused by: java.lang.RuntimeException: Unable to rollback transaction

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:85) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

          ... 7 more

      Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79) [drools-spring-5.5.0.Final.jar:5.5.0.Final]

          ... 8 more

        • 1. Re: HowTo : Configure jBPM console only for retrieving information? Commit / Rollback Issues...
          Maciej Swiderski Master

          the main issue is the persistence handling in your application. Since you have two persistence contexts (one in your web app and one in console) so you must ensure that whenever transaction is committed the current persistence context (entity manager) is cleared and thus won't cache entities in it. As that will lead to optimistic lock exceptions since there are two different apps changing the entities. Please check if your web application (spring) does properly clean up entity manager on transaction completion.

           

          jBPM by default uses JTA transaction synchronization to clean it up but not sure if you use JTA in your spring setup.

           

          HTH

          • 2. Re: HowTo : Configure jBPM console only for retrieving information? Commit / Rollback Issues...
            Franck cdsosi Newbie

            Hi Maciej,

             

            Thanks a lot for your reply.

             

            To give you some information.

             

            1- Here is an extract of my spring configuration file.

             

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

            <beans xmlns="http://www.springframework.org/schema/beans"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbpm="http://drools.org/schema/drools-spring"

                xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

                                       http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring-1.3.0.xsd">

                <bean id="emf"

                    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

                    <property name="persistenceUnitName" value="org.jbpm.persistence.jpa" />

                </bean>

             

                <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">

                    <property name="entityManagerFactory" ref="emf" />

                </bean>

             

                <jbpm:kbase id="kbase1">

            [...]

             

            2- My persistence.xml file used in my application

             

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

            <persistence version="2.0"

              xmlns="http://java.sun.com/xml/ns/persistence"

              xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

              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 http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

             

              <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="RESOURCE_LOCAL">

                <provider>org.hibernate.ejb.HibernatePersistence</provider>

                <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>

                <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>

                <mapping-file>META-INF/ProcessInstanceInfoMapping-JPA2.xml</mapping-file>

             

                <class>org.drools.persistence.info.SessionInfo</class>

                <class>org.drools.persistence.info.WorkItemInfo</class>

                <class>org.jbpm.process.audit.ProcessInstanceLog</class>

                <class>org.jbpm.process.audit.NodeInstanceLog</class>

                <class>org.jbpm.process.audit.VariableInstanceLog</class>

                <properties>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

                  <property name="hibernate.max_fetch_depth" value="3" />

                  <property name="hibernate.hbm2ddl.auto" value="update" />

                  <property name="hibernate.show_sql" value="false" />

                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

             

                  <!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->     

                  <property name="hibernate.id.new_generator_mappings" value="false" />

                </properties>

               

              </persistence-unit>

            </persistence>

             

            3- extract from the datasources declared in my standalone.xml

             

                <subsystem xmlns="urn:jboss:domain:datasources:1.0">
                    <datasources>
                        <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="JBPMDS" enabled="true" use-java-context="true" use-ccm="true">
                            <connection-url>jdbc:mysql://localhost:3306/jbpm5</connection-url>
                            <driver>mysql</driver>
                            <pool>
                                <min-pool-size>20</min-pool-size>
                                <max-pool-size>42</max-pool-size>
                                <prefill>false</prefill>
                                <use-strict-min>false</use-strict-min>
                                <flush-strategy>FailingConnectionOnly</flush-strategy>
                            </pool>
                            <security>
                                <user-name>test</user-name>
                                <password>test</password>
                            </security>
                            <validation>
                                <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                                <validate-on-match>false</validate-on-match>
                                <background-validation>false</background-validation>
                            </validation>
                        </datasource>
                        <datasource jta="false" jndi-name="java:jboss/datasources/taskDS" pool-name="TASKDS" enabled="true" use-java-context="true" use-ccm="true">
                            <connection-url>jdbc:mysql://localhost:3306/task</connection-url>
                            <driver>mysql</driver>
                            <pool>
                                <min-pool-size>20</min-pool-size>
                                <max-pool-size>42</max-pool-size>
                                <prefill>false</prefill>
                                <use-strict-min>false</use-strict-min>
                                <flush-strategy>FailingConnectionOnly</flush-strategy>
                            </pool>
                            <security>
                                <user-name>test</user-name>
                                <password>test</password>
                            </security>
                            <validation>
                                <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                                <validate-on-match>false</validate-on-match>
                                <background-validation>false</background-validation>
                            </validation>
                        </datasource>
                        <drivers>
                            <driver name="mysql" module="com.mysql">
                                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                            </driver>
                        </drivers>
                    </datasources>
                </subsystem>

             

            => Does this configuration seem to be Ok for you as far as JTA transaction are concerned? I think this is probably not the case because :

            • my persitence.xml shoud declare transaction-type="JTA" instead of transaction-type="RESOURCE_LOCAL" for PU  "org.jbpm.persistence.jpa" correct?
            • I have somethings to do regarding my spring configuration file as it is explained in 19.3.1 from jBPM 5.4.0.Final documentation, correct ? A question by the way, does the transaction manager defined in the spring configuration overwrite the one defined in persistence.xml?

             

            Are the above listed elements the only things to do to get rid of my problem?


            you must ensure that whenever transaction is committed the current persistence context (entity manager) is cleared and thus won't cache entities in it

            Does the use of a JTA Transaction Manager ensure that or are there others things to do?

            Are there examples or code samples available anywhere showing that?

             

            Kind Regards

             

            Franck

            • 3. Re: HowTo : Configure jBPM console only for retrieving information? Commit / Rollback Issues...
              Franck cdsosi Newbie

              Well I can't find my way to solve this problem.

               

              As Maciej suggested, I set a JTA Transaction Manager in my Spring Conf or tried to set one to be more accurate

              • I first tried a Bitronix Transaction but experienced some problems so I switched to java:jboss/TransactionManager. I put direct JNDI name as I read that java:/TransactionManager seems to be incorrect within the class org.hibernate.transaction.JBossTransactionManagerLookup for JAS 7
              • I also changed my persistent unit name from org.jbpm.persistence.jpa to org.jbpm.persistence.jta => Is this required if there is another web application deployed such as jbpm-gwt-console-server.war which comes with its own persistence.xml (and with PU = "org.jbpm.persistence.jpa")?

               

              1- Extract of my new Spring configuration :

               

              <beans xmlns="http://www.springframework.org/schema/beans"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbpm="http://drools.org/schema/drools-spring"

                xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

                                         http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring-1.3.0.xsd">

               

               

                <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

                  <property name="persistenceUnitName" value="org.jbpm.persistence.jta"/>

                </bean>

               

                <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">

                      <property name="transactionManagerName" value="java:jboss/TransactionManager"/>

                </bean>

              [....]

               

              2- My persistence.xml file used in my own application

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

              <persistence version="2.0"

                xmlns="http://java.sun.com/xml/ns/persistence"

                xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

                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 http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

               

                <persistence-unit name="org.jbpm.persistence.jta" transaction-type="JTA">

                  <provider>org.hibernate.ejb.HibernatePersistence</provider>

                  <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>

                  <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>

                  <mapping-file>META-INF/ProcessInstanceInfoMapping-JPA2.xml</mapping-file>

               

                  <class>org.drools.persistence.info.SessionInfo</class>

                  <class>org.drools.persistence.info.WorkItemInfo</class>

                  <class>org.jbpm.process.audit.ProcessInstanceLog</class>

                  <class>org.jbpm.process.audit.NodeInstanceLog</class>

                  <class>org.jbpm.process.audit.VariableInstanceLog</class>

                  <properties>

                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

                    <property name="hibernate.max_fetch_depth" value="3" />

                    <property name="hibernate.hbm2ddl.auto" value="update" />

                    <property name="hibernate.show_sql" value="false" />

                    <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" /> -->

                    <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

               

                    <!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->     

                    <property name="hibernate.id.new_generator_mappings" value="false" />

                  </properties>

                 

                </persistence-unit>

              </persistence>

               

              How does this persistence.xml react in a Spring configuration environment? In my spring conf, I declare a Transaction Manager, no conflict with hibernate.transaction.manager_lookup_class declared in persistence.xml? Moreover is org.hibernate.transaction.JBossTransactionManagerLookup correct as far as JNDI name is concerned inside that class?

               

              I still experienced issues as far as transaction are concerned :

              WARN  [org.hibernate.ejb.AbstractEntityManagerImpl] (http--127.0.0.1-8080-13) HHH000326: Cannot join transaction: do not override hibernate.transaction.factory_class

              ERROR [org.drools.persistence.SingleSessionCommandService] (http--127.0.0.1-8080-7) Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call

              [...]

              javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call

               

              Can anyone help on that damn problem !

               

              Some other questions :

              I just want to use jBPM console to watch active process instances and their variables, diagrams. I also want to see task inside Group and Personal Tasks but do not want to start/complete/claim these inside the jbpm console as this is the work of my application.

              As far as this requirement is concerned, how do I need to proceed with statefulknowledge session. In my application, I create only one and then reload it after a server stop / restart. My only session keeps alive all mu application life time (each new process is started in the same session). My question is about the session initialized by jBPM console. Does this one need to be different from the one inside my application?

               

              I alse tried to set my datasources as xa ones in standalone.xml because others had similiar problems to mine but no success, still problems with transactions... Are xa-datasources needed?

               

              I think my problems are related to multi-thread / concurrency ones. May be I am wrong but can jBPM Experts give their feelings about that? I also read a JIRA on that :

              [JBPM-3814] Session thread safe support in JTA/EE environment - JBoss Issue Tracker

               

              I can give more stack trace if needed...

               

              All of these problems arise when I try to "play" with jBPM console. Is there any way to get rid of my problem?

               

              Any help greatly appreciated