[jboss-user] [jBPM] - Re: createProcessInstance + startProcessInstance does not update processinstanceinfo state

Rudi Fisher do-not-reply at jboss.com
Thu Apr 26 09:47:30 EDT 2012

Rudi Fisher [https://community.jboss.org/people/rudi_fisher] created the discussion

"Re: createProcessInstance + startProcessInstance does not update processinstanceinfo state"

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

A had a similar problem.
*My setup is:* JBPM 5.2.0 + JPA + Hibernate + java:jboss/TransactionManager + MSSQL + JBoss AS 7

I'm using WI handlers in similar way - some are synchronous and some are asynchronous, but state of process wasn't persisted correctly in save points (at the end of execution of WI handler). I found that my transaction manager didn't work correctly and all process instances stay all the time in memmory and wasn't loaded/inserted into DB. Problem was that my transaction manager wasn't added into Environment.

You can easy forget for this very important step in your code. Everything seems working correctly if you are not restarting jBPM and you don't need any recovery utility. I was looking into manual about transactions here:  http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html#d0e2914 http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html#d0e2914 I also read source code of jbpm-gwt-console (class CommandDelegate) but there is now direct description how to configure and use JBoss transaction manager. Maybe small update of manual should by helpfull.

Maybe this help someone with similar issue. Correct codes:
Configuration of transaction manager for JBoss AS 7 in persistence.xml:
<property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" />

Do not forget for this during initialization of your sessions, environment ... for example:
// get transaction manager from hibernate configuration (see persistence.xml)
TransactionManagerLookup transactionManagerLookup = ((SessionFactoryImplementor)((HibernateEntityManagerFactory)emf).getSessionFactory()).getSettings().getTransactionManagerLookup();
TransactionManager transactionManager = transactionManagerLookup.getTransactionManager(null);
// this is very important step to add transactionManager into env. Else transaction manager will not be initialized correctly for jbpm.
*env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);*

Working for me correctly now.

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120426/1d0f625b/attachment-0001.html 

More information about the jboss-user mailing list