Bug 868873 - Exception is thrown when disposing JPA knowledge session on JBoss EAP 5.1
Exception is thrown when disposing JPA knowledge session on JBoss EAP 5.1
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion) (Show other bugs)
BRMS 5.3.1
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Kris Verlaenen
Radovan Synek
Depends On:
  Show dependency treegraph
Reported: 2012-10-22 06:45 EDT by Radovan Synek
Modified: 2012-10-24 11:04 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-10-24 02:52:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
server log (50.03 KB, text/x-log)
2012-10-22 06:45 EDT, Radovan Synek
no flags Details
reproducer: maven ear project (21.20 KB, application/zip)
2012-10-22 07:17 EDT, Radovan Synek
no flags Details
DS configuration for Oracle11g (1.76 KB, text/xml)
2012-10-22 07:19 EDT, Radovan Synek
no flags Details

  None (edit)
Description Radovan Synek 2012-10-22 06:45:09 EDT
Created attachment 631397 [details]
server log

Description of problem:
Exception saying that "This session was previously disposed." is thrown when trying to dispose JPA knowledge session after successfull jbpm process completion.

process instance launched from EJB with CMT (I tried BMT too - with the same exception at result)

See the attached server log for more detailed information.

Version-Release number of selected component (if applicable):

Steps to Reproduce:
1. deploy the reproducer on JBoss EAP/AS 
2. access URL: http://localhost:8080/process/run
3. search the server log for the error stacktrace
The reproducer will be attached soon.
Comment 1 Radovan Synek 2012-10-22 07:17:47 EDT
Created attachment 631406 [details]
reproducer: maven ear project
Comment 2 Radovan Synek 2012-10-22 07:19:00 EDT
Created attachment 631407 [details]
DS configuration for Oracle11g
Comment 3 Kris Verlaenen 2012-10-23 10:52:30 EDT
Looking at ProcessLauncher, it seems you're disposing the session in the same transaction as all the other modifications.  

    public String launchProcess() {
        String msg = null;
        try {       
        } catch (Throwable ex) {
            throw new RuntimeException(ex);
        return msg;

Unfortunately that isn't possible, as dispose will release all data etc., and if you do this before the transaction is committed, the data needed to commit the transaction is no longer available.

Disposing the session after the transaction has been committed should solve this.
Comment 4 Radovan Synek 2012-10-24 02:52:00 EDT
Hi Kris, 

you are right - I have tried it with calling dispose() separately and it worked just fine. Thanks for explanation.

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