Hibernate issues with Singleton strategy and EJBTimerScheduler in RHPAM

Solution Unverified - Updated -

Issue

  • I get the following error. Once hit, the error is repeatedly thrown.
org.kie.server.remote.rest.jbpm.ProcessResource getWorkItemByProcessInstance Unexpected error during processing Unable to commit transaction
                                 java.lang.RuntimeException: Unable to commit transaction
        at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:248)
        at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:607)
        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
        at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:82)
        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
        at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73)
        at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:397)
        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession$1.getWorkItem(CommandBasedStatefulKnowledgeSession.java:186)
        at org.jbpm.kie.services.impl.ProcessServiceImpl.getWorkItemByProcessInstance(ProcessServiceImpl.java:490)
        at org.kie.server.services.jbpm.ProcessServiceBase.getWorkItemByProcessInstance(ProcessServiceBase.java:326)
    at org.kie.server.remote.rest.jbpm.ProcessResource.getWorkItemByProcessInstance(ProcessResource.java:471)
    at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
    at java.lang.reflect.Method.invoke(Method.java:620)
    at org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest(InvokeMethodHandler.java:63)
...
Caused by: javax.transaction.RollbackException
    at com.ibm.tx.jta.impl.TransactionImpl.stage3CommitProcessing(TransactionImpl.java:1272)
    at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1042)
    at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:963)
    at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:439)
    at com.ibm.tx.jta.impl.TranManagerSet.commit(TranManagerSet.java:191)
    at com.ibm.ws.tx.jta.UserTransactionImpl.commit(UserTransactionImpl.java:302)
    at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:245)
    ... 86 more
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Flush during cascade is dangerous
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316)
        at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1510)
        at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:114)
        at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53)
        at com.ibm.tx.jta.impl.RegisteredSyncs.coreDistributeBefore(RegisteredSyncs.java:291)
        at com.ibm.ws.tx.jta.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:153)
        at com.ibm.ws.tx.jta.TransactionImpl.prePrepare(TransactionImpl.java:2408)
        at com.ibm.ws.tx.jta.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:608)
        at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1029)
        ... 91 more
Caused by: org.hibernate.HibernateException: Flush during cascade is dangerous
        at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1191)
        at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)
        at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:109)
        ... 97 more

Environment

  • Red Hat BPM Suite
    • 6.4.9
  • Singleton strategy
  • kie-server
  • EJB Timer Scheduler (which is default in kie-server)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In