Bug 1121181 - "This session was previously disposed" when used Spring+JTA+PER_PROCESS_INSTANCE
Summary: "This session was previously disposed" when used Spring+JTA+PER_PROCESS_INSTANCE
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: jBPM Core
Version: 6.0.2
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ER1
: ---
Assignee: Maciej Swiderski
QA Contact: Ivo Bek
URL:
Whiteboard:
Depends On:
Blocks: 1115481 1163975
TreeView+ depends on / blocked
 
Reported: 2014-07-18 14:58 UTC by Alessandro Lazarotti
Modified: 2019-03-22 07:15 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Fixed Issue Summary: An exception error would occur when using Spring, JTA, and PER_PROCESS_INSTANCE strategy in RuntimeManager: Java.lang.IllegalStateException: Illegal method call. This session was previously disposed. This issue has been resolved in 6.0.3 with the update of various classes in the persistence.xml file.
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
reproducer - jUnit test (524.87 KB, application/zip)
2014-07-18 14:59 UTC, Alessandro Lazarotti
no flags Details

Description Alessandro Lazarotti 2014-07-18 14:58:02 UTC
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

Comment 1 Alessandro Lazarotti 2014-07-18 14:59:47 UTC
Created attachment 919113 [details]
reproducer - jUnit test

Comment 4 Maciej Swiderski 2014-07-18 17:40:35 UTC
fix applied on 6.0.x branch

jbpm
6.0.x:
https://github.com/droolsjbpm/jbpm/commit/ace41e4ad4a12c90ac0d7b3a2e5dabfd0ab43318

Comment 5 Josh West 2014-07-23 02:49:11 UTC
This error is happening for the session PER_REQUEST strategy too.

Comment 6 Ivo Bek 2014-08-26 14:29:29 UTC
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


Note You need to log in before you can comment on or make changes to this bug.