2 Replies Latest reply on Aug 12, 2015 2:43 PM by clp207

    Error with Fake UserTransaction, JPA Persistence, and Per Process Instance Strategy

    clp207

      I am using the fake UserTransaction workaround with jbpm 6.2 running on Wildfly 8.2. My project consists of the rewards CDI example along with a process that uses JPA persistence and the PER_PROCESS_INSTANCE deployment strategy.  It works fine if I start the process in my @Named jsf backing bean. However, if I move the code into an ejb, I get this error

       

      2015-08-03 07:14:48,470 WARN  [com.arjuna.ats.arjuna] (default task-16) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff7f000001:-6b890fb3:55bf5989:2ed, org.drools.persistence.jta.JtaTransactionSynchronizationAdapter@191faf7 >: java.lang.IllegalStateException: Illegal method call. This session was previously disposed.

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.checkAlive(StatefulKnowledgeSessionImpl.java:1221) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.getId(StatefulKnowledgeSessionImpl.java:1205) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:214) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:120) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:155) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:140) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:64) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.info.SessionInfo.transform(SessionInfo.java:81) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:42) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:39) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          ....

       

      2015-08-03 07:14:48,496 ERROR [org.jboss.as.ejb3.invocation] (default task-16) JBAS014134: EJB Invocation failed on component JbpmApiService for method public org.kie.api.runtime.process.ProcessInstance edu.psu.javaee.services.workflow.dw.ejb.JbpmApiService.startProcess(java.lang.String,edu.psu.javaee.services.workflow.dw.model.ItwoAccessRequest): javax.ejb.EJBTransactionRolledbackException: Transaction rolled back

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:139) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:119) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

         ...

      Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.

          at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1178)

          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.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]

          ... 95 more

      Caused by: java.lang.IllegalStateException: Illegal method call. This session was previously disposed.

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.checkAlive(StatefulKnowledgeSessionImpl.java:1221) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.getId(StatefulKnowledgeSessionImpl.java:1205) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:214) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:120) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:155) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:140) [drools-core-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:64) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.info.SessionInfo.transform(SessionInfo.java:81) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:42) [drools-persistence-jpa-6.2.0.Final.jar:6.2.0.Final]

          at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:39) [drools-persistence-jpa-6.2.0.Final.jar:6.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:358)

          at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)

          at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)

          at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)

          ... 98 more

       

       

      Any ideas? I've tried setting diferent @Transactional annotations on the EJB method, but still get the same error.

       

      I can provide my example projects if that is helpful.

       

      Thanks!