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.
fixed with excellent collaboration with Marek (so big thanks!) droolsjbpm-integration master: https://github.com/droolsjbpm/droolsjbpm-integration/commit/328711ff08ce1da21ee578c3b48c418241883649 https://github.com/droolsjbpm/droolsjbpm-integration/commit/09b109befcbcdf4e6c4f408093959ce22926d7d0 https://github.com/droolsjbpm/droolsjbpm-integration/commit/4c50c957497a2551a3d1b9aa5ec672ca5537f9cd https://github.com/droolsjbpm/droolsjbpm-integration/commit/c6ebdb23d8d945bd8054b5784f1aa89619238d70 6.4.x: https://github.com/droolsjbpm/droolsjbpm-integration/commit/8903874c66a745e1670c1e47ffe45bb98eedd42f https://github.com/droolsjbpm/droolsjbpm-integration/commit/2d4dbb6aef01e5fd9e82c14cd3dfae76284a2d3a https://github.com/droolsjbpm/droolsjbpm-integration/commit/02d3fe8a7d03d0c822be0e78143dfe6282ef1357 https://github.com/droolsjbpm/droolsjbpm-integration/commit/42592da60c5cde23599b43e9dc4ab54e99f230c7
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.