Bug 1316966 - OSGi: drools-persistence-jpa throws NPE when starting a process via RuntimeManager
Summary: OSGi: drools-persistence-jpa throws NPE when starting a process via RuntimeMa...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER3
: 6.3.0
Assignee: Edson Tirelli
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-11 14:47 UTC by Marek Winkler
Modified: 2020-03-27 20:13 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:13:19 UTC
Type: Bug
Embargoed:


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

Description Marek Winkler 2016-03-11 14:47:42 UTC
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 14:16:10 UTC
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.