Bug 1316966 - OSGi: drools-persistence-jpa throws NPE when starting a process via RuntimeManager
OSGi: drools-persistence-jpa throws NPE when starting a process via RuntimeMa...
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity high
: ER3
: 6.3.0
Assigned To: Maciej Swiderski
Marek Winkler
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-11 09:47 EST by Marek Winkler
Modified: 2016-04-18 10:16 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Full stacktrace (9.22 KB, text/plain)
2016-03-11 09:47 EST, Marek Winkler
no flags Details

  None (edit)
Description Marek Winkler 2016-03-11 09:47:42 EST
Created attachment 1135261 [details]
Full stacktrace

Description of problem:

When starting a jBPM process using RuntimeManager in OSGi environment, I have to specify in the environment the references to all of the following:
  - EnvironmentName.ENTITY_MANAGER_FACTORY
  - EnvironmentName.TRANSACTION_MANAGER
  - EnvironmentName.TRANSACTION
  - EnvironmentName.TRANSACTION_SYNCHRONIZATION_REGISTRY

If only TransactionManager and EntityManagerFactory are specified, Drools JtaTransactionManager throws the following NPE (see attachment for the full stacktrace):

Caused by: java.lang.NullPointerException
	at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:255)

The root cause might be that it tries to retrieve UserTransaction or TSR from JNDI which fails in OSGi environment (probably different lookup method is needed).

The problem for users is that when using blueprint XML for <kie:environment> definition, the user is not allowed to specify the latter two references (UserTransaction and TSR).

I would probably suggest that:
  1) JtaTransactionManager is able to work even when not all 4 references are set in the Environment,
  2) kie-aries-blueprint allows for specifying UserTransaction and TSR in <kie:environment> in blueprint xml.

If 1) is not possible to achieve, we should at least fix 2).

Version-Release number of selected component (if applicable):
BRMS 6.2.2
Fuse 6.2.1

How reproducible:
always

Steps to Reproduce:
1. run 'mvn clean test -Dtest=KieBlueprintjBPMPersistenceKarafIntegrationTest' from PR https://github.com/droolsjbpm/droolsjbpm-integration/pull/315

Actual results:
The NPE is thrown.

Expected results:
Test passes.

Additional info:
You can uncomment setting of UserTransaction and TSR at org.drools.karaf.itest.beans.ProcessWithPersistenceBean, line 79, and see that the test passes.
Comment 4 Marek Winkler 2016-04-18 10:16:10 EDT
Verified in BRMS 6.3.0 ER3.

It is now possible to declare <kie:environment> element in KIE-Aries-Blueprint XML with the following child elements:
  - <kie:transaction-manager>
  - <kie:transaction-sync-registry>
  - <kie:user-transaction>
  - <kie:entity-manager-factory>

jBPM persistence using environment with all the above properties works in Fuse 6.2.1.

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