[jboss-dev-forums] [jBPM Development] - JBPM6 Spring Persistence and Runtime Manager

Alexander Herwix do-not-reply at jboss.com
Wed Aug 21 16:52:32 EDT 2013


Alexander Herwix [https://community.jboss.org/people/herwix] created the discussion

"JBPM6 Spring Persistence and Runtime Manager"

To view the discussion, visit: https://community.jboss.org/message/833455#833455

--------------------------------------------------------------
Hey guys,

I have been trying to integrate JBPM6 in my Spring-Hibernate based Grails application, but it seems that I'm stuck and maybe you guys here could point me in the right direction.

I am trying to get the RuntimeManager working with a local spring transaction scheme. I have tried a lot of stuff but can't seem to find the right approach.

I have set up a EntityManagerFactory bean, which loads the persistence-unit org.jbpm.presistence.jpa (with transaction-type "Resource_local") with the org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.
I have also set up a org.springframework.orm.jpa.JpaTransactionManager bean.

When I now try to get a runtimeEngine via the RuntimeEnvironmentBuilder:


RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefaultInMemory()
                .userGroupCallback(getUserGroupCallback())
                .entityManagerFactory(entityManagerFactory)
                .registerableItemsFactory(new KModuleRegisterableItemsFactory(kcontainer,''))
                .addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER,jbpmTransactionManager)
                .get();
  
RuntimeManager manager = RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment);
 
RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
 


I get the following error: 

NamingException occurred when processing request: [GET] /bpm/test/
Cannot create resource instance. Stacktrace follows:
javax.naming.NamingException: Cannot create resource instance
          at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:116)
          at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
          at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
          at javax.naming.InitialContext.lookup(InitialContext.java:411)
          at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:122)
          at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:69)
          at org.jbpm.shared.services.impl.JbpmJTATransactionManager.<init>(JbpmJTATransactionManager.java:39)
          at org.jbpm.runtime.manager.impl.factory.LocalTaskServiceFactory.newTaskService(LocalTaskServiceFactory.java:48)
          at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.getRuntimeEngine(PerProcessInstanceRuntimeManager.java:94)
          at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.init(PerProcessInstanceRuntimeManager.java:258)
          at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newPerProcessInstanceRuntimeManager(RuntimeManagerFactoryImpl.java:103)
          at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newPerProcessInstanceRuntimeManager(RuntimeManagerFactoryImpl.java:94)
          at bpm.TestController$$EOFBIT6u.index(TestController.groovy:82)
          at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
          at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:722)


Looking at the stacktrace I found the the LocalTaskServiceFactory where the documentation says:

/**
 * Regular <code>TaskServiceFactory</code> implementation that shall be used for non CDI environments.
 * Creates new <code>TaskService</code> instance for every call to the factory.
 * <code>TaskService</code> instance will be equipped with <code>JbpmJTATransactionManager</code> 
 * for transaction management, this is mandatory as it must participate in already active
 * transaction if such exists.
 */

So it seems it's not possible to use the RuntimeManager without a JTA Transaction Manager? I thought it might be possible to supply the localTransactionManager via the Environment? But I am fishing in the dark.

If I am totally off the mark here in what I am doing, I would appreciate any pointer into the recommended way to integrate jbpm6 (and especially the runtime manager) into a spring-hibernate based application. I have looked at kie-spring, but there is little jbpm specific stuff. 

Cheers, Alex
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/833455#833455]

Start a new discussion in jBPM Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130821/e461129a/attachment-0001.html 


More information about the jboss-dev-forums mailing list