Description of problem: When used Spring+JTA+PER_PROCESS_INSTANCE, in RuntimeManager creation is throwed: java.lang.IllegalStateException: Illegal method call. This session was previously disposed. at org.drools.core.reteoo.DisposedReteooWorkingMemory.getProcessRuntime(DisposedReteooWorkingMemory.java:261) at org.drools.core.impl.StatefulKnowledgeSessionImpl.getProcessRuntime(StatefulKnowledgeSessionImpl.java:900) at org.drools.persistence.SingleSessionCommandService$SynchronizationImpl.afterCompletion(SingleSessionCommandService.java:457) at org.drools.persistence.TransactionSynchronizationContainer.afterCompletion(TransactionSynchronizationContainer.java:26) at org.kie.spring.persistence.SpringTransactionSynchronizationAdapter.afterCompletion(SpringTransactionSynchronizationAdapter.java:37) How reproducible: Always Steps to Reproduce: reproducer attached Actual results: java.lang.IllegalStateException Expected results: No exceptions
Created attachment 919113 [details] reproducer - jUnit test
fix applied on 6.0.x branch jbpm 6.0.x: https://github.com/droolsjbpm/jbpm/commit/ace41e4ad4a12c90ac0d7b3a2e5dabfd0ab43318
This error is happening for the session PER_REQUEST strategy too.
Verified in BPMS 6.0.3.ER1 (6.0.3-redhat-5). After the version update, the following class needs to be updated in persistence.xml: org.jbpm.services.task.impl.model.BAMTaskSummaryImpl > org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl Josh, on your request I checked also the PER_REQUEST strategy by changing the type of RuntimeManager in the beans context by: <property name="type" value="PER_REQUEST"/> As you can see below, output of the test (for PER_REQUEST and PER_PROCESS_INSTANCE strategy) does NOT contain any exceptions due to: 4623 [main] ERROR org.springframework.transaction.support.TransactionSynchronizationUtils - TransactionSynchronization.afterCompletion threw exception java.lang.IllegalStateException: Illegal method call. This session was previously disposed. ...... 1742 [main] WARN bitronix.tm.Configuration - cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!). 1742 [main] WARN bitronix.tm.Configuration - cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!). 1797 [main] INFO bitronix.tm.Configuration - JVM unique ID: <10.34.3.149> 1797 [main] INFO bitronix.tm.Configuration - JVM unique ID: <10.34.3.149> 1826 [main] WARN bitronix.tm.journal.DiskJournal - active log file is unclean, did you call BitronixTransactionManager.shutdown() at the end of the last run? 1826 [main] WARN bitronix.tm.journal.DiskJournal - active log file is unclean, did you call BitronixTransactionManager.shutdown() at the end of the last run? 1933 [main] INFO bitronix.tm.recovery.Recoverer - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/jbpm-ds] (restricted to serverId '10.34.3.149') 1933 [main] INFO bitronix.tm.recovery.Recoverer - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/jbpm-ds] (restricted to serverId '10.34.3.149') 3013 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@99cf34: defining beans [jbpmEMF,btmConfig,BitronixTransactionManager,jbpmTxManager,process,runtimeEnvironment,runtimeManager,logService]; root of factory hierarchy 3013 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@99cf34: defining beans [jbpmEMF,btmConfig,BitronixTransactionManager,jbpmTxManager,process,runtimeEnvironment,runtimeManager,logService]; root of factory hierarchy 3043 [main] INFO org.springframework.transaction.jta.JtaTransactionManager - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s) 3043 [main] INFO org.springframework.transaction.jta.JtaTransactionManager - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s) 3045 [main] INFO org.springframework.transaction.jta.JtaTransactionManager - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s) 3045 [main] INFO org.springframework.transaction.jta.JtaTransactionManager - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s) 4119 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4119 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4196 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4196 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4198 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4198 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4202 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4202 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4205 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4205 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4209 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4209 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4211 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4211 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4215 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource 4215 [main] WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource Starting process instance 1 Process started Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.13 sec