-
Bug
-
Resolution: Done
-
Critical
-
6.0.2
+++ This bug was initially created as a clone of Bug #1163961 +++
Platform BZ for https://issues.jboss.org/browse/JBPM-4369
See attachments in that Jira above
--------------------------
I'm getting a:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
When trying to use JBPM with engine with spring transaction management.
The call stack (simplified) that leads to the errors is as follows:
1. org.jbpm.runtime.manager.impl.PerRequestRuntimeManager.getRuntimeEngine():66 creates a RuntimeEngine passing KieSession instantiated via the JPASessionFactory
2. org.jbpm.runtime.manager.impl.factory.JPASessionFactory.newKieSession():42 creates a new KieSession using the RuntimeEnvironment that was initially injected
3. The creation of the KieSession causes the invocation of org.drools.persistence.SingleSessionCommandService.initTransactionManager(Environment):267.
Before the completion of this method, the original transaction manager and the PersistenceContextManager are replaced with instances of org.kie.spring.persistence.KieSpringJpaManager and org.kie.spring.persistence.KieSpringTransactionManager
within the environment
4. At later stage, one of the callback needed to initialize the RuntimeManger, will invoke org.jbpm.runtime.manager.impl.AbstractRuntimeManager.getTransactionManager():233.
This will throw javax.naming.NoInitialContextException because the environment instance used by the AbstractRuntimeManager is not the same that was corrected by the SingleSessionCommandService in step 3.
Reason for this is that on step 2, org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.getEnvironment():150 is called and it causes the environment to be cloned rather than passed by reference.
Would the solution to the problem be to change org.jbpm.runtime.manager.impl.factory.JPASessionFactory.newKieSession():42 so that it uses SimpleRuntimeEnvironment.getEnvironmentTemplate() instead?
I attached part of my spring configuration for reference.
— Additional comment from JBoss Product and Program Management on 2014-11-13 14:40:06 EST —
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.
— Additional comment from Alessandro Lazarotti on 2014-11-13 14:45:32 EST —
https://github.com/droolsjbpm/jbpm/commit/fd2344a5342a6606bbc28a467ccca20afacb6568
— Additional comment from on 2014-12-16 10:40:42 EST —
Verified in 6.1.0 ER3
- duplicates
-
RHBPMS-1616 javax.naming.NoInitialContextException when using JPA persistence with spring
- Verified
- is blocked by
-
RHBPMS-1616 javax.naming.NoInitialContextException when using JPA persistence with spring
- Verified