Discussion:
[jboss-user] [jBPM] - Spring 3 & jBPM 5 & LocalTaskService
John Bize
2012-02-16 20:29:04 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
*Has anyone out there successfully integrated Spring 3 (3.1) & jBPM 5 (5.2) in an application using the LocalTaskService?*

If so, I would very much like to hear from you and see your initialization and configuration code.

Thank you very much.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
nwhiteside
2012-04-23 14:30:40 UTC
Permalink
nwhiteside [https://community.jboss.org/people/nwhiteside] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Im interested in hearing about this also, as our existing app is based on Spring 3 and we are evaluating how to add BMP...
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
John Bize
2012-10-31 19:05:18 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
*What about now? *

*Has anyone out there successfully integrated Spring 3 (3.1.3) & jBPM 5 (5.3) in an application using the LocalTaskService?
*

If so, I would very much like to hear from you and see your initialization and configuration code.  I've had serious Transaction issues.

Thank you very much.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-02 10:51:43 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
as far as I know it is supported. Do you ran into troubles with it? Maybe you could provide bit more details about your setup so we could try to investigate preferably test case :)

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
John Bize
2012-11-02 13:29:11 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Maciej,

I appreciate your responding tho this.

Just FYI, I can't post code snippets, because my project is on an isolated network.  In fact, I can only import non-beta libraries.  Anything else has to be typed in.  So if you know of software or examples, please point me to any JARs I would need and not only test code on github.

I've found some posts indicating some of the same problems, but there don't appear to me a lot of people using the LocalTaskService too.

My project stack is:
* Spring 3.1.0.RELEASE
* jBPM 5.2.0.Final
* Drools 5.3.1.Final
* Richfaces 4.2.2.Final
* Hibernate 3.5.6-Final
* Java 1.6 (Weblogic 10.3.4 or Tomcat 6)

I started with three separate but related persistence units, one for each of the jBPM Process, the jBPM Task, and my own Application data.  I tried to use JTA, but ran into: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()

I'm running in a Weblogic container, but all my dependencies are in my WAR. (i.e. It will run in Tomcat too.)

So, I consolidated all of my persistence units into one, and used the Spring JPA Transaction Manager (<tx:annotation-driven...).  That seemed to work until I realized that there were some pretty serious race conditions.  It looks like the jBPM has wrappers that aren't respcting the Spring Transaction boundaries.  For example, if I'm reading TaskInfos while someone is processing one of the Tasks, I get errors instead of the current data.  Data from the two transactions should not interact.  It looks like stuff is being partially committed beyond my control.

Idealy, I would be able to enable JTA transactions in my application and just let transactions for the original three Persistence Units be managed properly.  Alternatively, it might work if I left the PUs combined, but somehow disabled jBPM transaction management, instead setting the @Transactional boundaries only in my service layer APIs.

I hope you can shed some light, offer up configuration and code examples, or even a tutorial.  If upgrading to the latest jBPM, Hibernate, and Spring would solve all my problems, I would happily go that route.

Thanks very much,
John
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-02 13:37:29 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
John, thanks for details. Completely understand that not always code can be shared. What I try to prepare is a sample project that uses spring, local task service to see how it can be configured and executed. Most likely will take me few days but will keep you posted.

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
John Bize
2012-11-02 15:05:40 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Thanks so much... Standing by.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Ted Pan
2012-11-02 16:08:30 UTC
Permalink
Ted Pan [https://community.jboss.org/people/ted.pan] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
I can provide you a sample as soon as this issue got fixed https://community.jboss.org/thread/212203?tstart=0 https://community.jboss.org/thread/212203?tstart=0

I have a simple web application, which is running on Tomcat. and use Spring 3.1.0, jBPM5.4.0.CR1, Drools5.5.0.CR1.

It runs ok except for the LocalTaskService issue(ttps://community.jboss.org/thread/212203?tstart=0).  I can not complete the second subprocess when use LocalTaskService.



Ted
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-07 10:26:16 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
John, managed to find bit of time and start working on spring and jbpm example, you can find it https://github.com/mswiderski/jbpm-examples/tree/master/jbpm-spring-web here. It supose to be full web application but at the moment is only a showcase of configuration for two processes. Will work on it in my spare time for some days/weeks so eventually it will get more advanced. Let me know if there are any special cases you would like me to focus on first.

HTH
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
John Bize
2012-11-07 15:33:16 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
That's great Maciej, and very helpful.

I expect it won't be much more to incorporate JSF2.

I've probably had extra difficulty because I didn't have the drools-spring integration JAR.  Just so I'm clear, is the recommended (non-maven/non-online) way to get the drools-spring integration JAR, to download the droolsjbpm-integration-distribution package, and pull the drools-spring jar from that? 

Since I am only allowed to work with non-beta versions here, what are the correct (complimentary) final versions for the above stack, and will they work?  Do you know when jbpm5.4-final will be available?

Thanks again,
John
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-07 16:41:43 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Post by John Bize
I expect it won't be much more to incorporate JSF2.
Hmm probably bit more as I am not a JSF guy :) will start first with spring mvc I think...
Post by John Bize
I've probably had extra difficulty because I didn't have the drools-spring integration JAR.  Just so I'm clear, is the recommended (non-maven/non-online) way to get the drools-spring integration JAR, to download the droolsjbpm-integration-distribution package, and pull the drools-spring jar from that? 
in general, any way that will allow you to put drools-spring on classpath is good, you can download it from maven repo manually as well.
Post by John Bize
Since I am only allowed to work with non-beta versions here, what are the correct (complimentary) final versions for the above stack, and will they work?  Do you know when jbpm5.4-final will be available?
5.4 should be out in few days so you could treat this as evaluation only till it is released. Optionally you could downgrade version to 5.3.0 (jbpm) and 5.4.0 (drools)

HTH
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
John Bize
2012-11-07 17:36:22 UTC
Permalink
John Bize [https://community.jboss.org/people/jbize] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
If it's just for a few days, I can wait.  So what will be the correct stack, is the following correct and compatible?
* jBPM 5.4.0.Final
* Drools 5.5.0.Final
* droolsjbpm-integration-distribution-5.4.0.Final
* Spring 3.1.3.RELEASE
* Hibernate 4.1.8-Final

Is jBPM always one version behind Drools?  What about droolsjbpm-integration?

Thanks,
John
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-09 15:32:54 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
John, droolsjbpm-integration should be at the same level as drools - 5.5.0
Post by John Bize
Is jBPM always one version behind Drools?  What about droolsjbpm-integration?
at the moment yes, but from 6 they will be aligned.

HTH
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
suresh p
2012-11-28 20:29:49 UTC
Permalink
suresh p [https://community.jboss.org/people/sureshp] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Hi Maciej ,

Could you please complete this example ?

Thanks
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Eric He
2012-12-08 17:28:31 UTC
Permalink
Eric He [https://community.jboss.org/people/ehe888] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Hi Guys,

I am also struggling in config Spring + Local Human Task.

I am using Spring 3.0, JBPM 5.4.0.Final, Drools 5.5.0.Final

I can config to use JTA and Non-JTA, both can run in Spring container in my test case, but the only issue:

The human task never got insert into database, I can get ProcessInstance and Workitem inserted.
But I never see any "insert into Task"  sql statement in console.

I have debug it, it seems the program run to the em.persist(entity) statement in TaskPersistenceManager and no exception raised but nothing happend on Task entity.

I don't know why the task not got insert. Does anybody have the same issue?

My Spring Config as below

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans"
          xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns:drools=" http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring"
          xmlns:context=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context" xmlns:tx=" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx"
          xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  
               http://www.springframework.org/schema/context http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/context/spring-context-3.0.xsd     
               http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd">


          <context:annotation-config />


          <tx:annotation-driven transaction-manager="transactionManager"
                    proxy-target-class="true" />


          <context:component-scan base-package="com.my.jbpm.test" />


          <bean id="basicdataSource" class="org.apache.commons.dbcp.BasicDataSource">
                    <property name="driverClassName">
                              <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
                    </property>
                    <property name="url">
                              <value>jdbc:sqlserver://localhost:1433;databaseName=jbpm5</value>
                    </property>
                    <property name="username">
                              <value>sa</value>
                    </property>
                    <property name="password">
                              <value>123456</value>
                    </property>
          </bean>


          <bean id="xadataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"
                    init-method="init" destroy-method="close">
                    <property name="className"
                              value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" />
                    <property name="uniqueName" value="jdbc/jbpm-ds" />
                    <property name="minPoolSize" value="1" />
                    <property name="maxPoolSize" value="5" />
                    <property name="allowLocalTransactions" value="true" />
                    <property name="driverProperties">
                              <props>
                                        <prop key="URL">jdbc:sqlserver://localhost:1433;databaseName=jbpm5
                                        </prop>
                                        <prop key="user">sa</prop>
                                        <prop key="password">123456</prop>
                              </props>
                    </property>
          </bean>

          <bean id="entityManagerFactory"
                    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                    <property name="dataSource" ref="xadataSource" />
                    <property name="persistenceUnitName" value="org.jbpm.persistence.jpa" />
          </bean>




          <!-- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                    <property name="entityManagerFactory" ref="entityManagerFactory" /> <property
                    name="nestedTransactionAllowed" value="true" /> </bean> -->


          <bean id="btmConfig" factory-method="getConfiguration"
                    class="bitronix.tm.TransactionManagerServices">
          </bean>


          <bean id="BitronixTransactionManager" factory-method="getTransactionManager"
                    class="bitronix.tm.TransactionManagerServices" depends-on="xadataSource,transactionManager"
                    destroy-method="shutdown" />


          <bean id="transactionManager"
                    class="org.springframework.transaction.jta.JtaTransactionManager">
                    <property name="transactionManager" ref="BitronixTransactionManager" />
                    <property name="userTransaction" ref="BitronixTransactionManager" />
          </bean>


          <!-- <bean id="droolsTransactionManager"
                    class="org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager">
                    <constructor-arg name="ptm" ref="transactionManager" />
          </bean> -->


          <drools:grid-node id="node1" />


          <drools:resource id="resource1" type="BPMN2"
                    source="classpath:Evaluation.bpmn" />
          <drools:resource id="intfly_quotation" type="BPMN2"
                    source="classpath:com.intfly.Quotation.bpmn" />


          <drools:kbase id="kbase1" node="node1">
                    <drools:resources>
                              <drools:resource ref="resource1" />
                              <drools:resource ref="intfly_quotation" />
                    </drools:resources>
          </drools:kbase>


          <drools:ksession id="ksession" type="stateful" kbase="kbase1"
                    node="node1">
                    <drools:configuration>
                              <drools:work-item-handlers>
                                        <drools:work-item-handler name="ServiceStepComplete"
                                                  ref="ServiceStepCompleteHandler" />


                              </drools:work-item-handlers>


                              <drools:jpa-persistence>
                                        <drools:transaction-manager ref="transactionManager" />
                                        <drools:entity-manager-factory ref="entityManagerFactory" />
                              </drools:jpa-persistence>
                    </drools:configuration>
          </drools:ksession>


          <bean id="ServiceStepCompleteHandler" class="ServiceStepCompleteHandler" />


          <bean id="emailHandler" class="org.jbpm.process.workitem.email.EmailWorkItemHandler">
                    <constructor-arg name="host">
                              <value>smtp.gmail.com</value>
                    </constructor-arg>
                    <constructor-arg name="port">
                              <value>587</value>
                    </constructor-arg>
                    <constructor-arg name="userName">
                              <value> mailto:***@gmail.com ***@gmail.com</value>
                    </constructor-arg>
                    <constructor-arg name="password">
                              <value>310106781127283</value>
                    </constructor-arg>
          </bean>


          <!-- <bean id="HumanTaskHander" class="org.jbpm.process.workitem.wsht.HornetQHTWorkItemHandler">
                    <constructor-arg> <ref local="ksession" /> </constructor-arg> <property name="ipAddress"
                    value="127.0.0.1" /> <property name="port" value="10101" /> </bean> -->


          <bean id="sessionWrapper" class="com.my.jbpm.KSessionWrapper"
                    init-method="init" depends-on="ksession, internalTaskService"/>


          <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory"
                    factory-method="getSystemEventListener" />


          <bean id="userInfo" class="JpaUserInfoImpl" />


          <bean id="escalatedDeadlineHandler" class="org.jbpm.task.service.DefaultEscalatedDeadlineHandler">
                    <property name="userInfo" ref="userInfo" />
          </bean>


          <bean id="internalTaskService" class="org.jbpm.task.service.TaskService">
                    <property name="systemEventListener" ref="systemEventListener" />
                    <property name="escalatedDeadlineHandler" ref="escalatedDeadlineHandler" />
          </bean>


          <bean id="htTxManager"
                    class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager">
                    <constructor-arg ref="transactionManager" />
          </bean>


          <bean id="springTaskSessionFactory"
                    class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl"
                    init-method="initialize" depends-on="internalTaskService">
                    <property name="entityManagerFactory" ref="entityManagerFactory" />
                    <property name="transactionManager" ref="htTxManager" />
                    <property name="useJTA" value="true" />
                    <property name="taskService" ref="internalTaskService" />
          </bean>


          <bean id="taskService" class="org.jbpm.task.service.local.LocalTaskService"
                    depends-on="springTaskSessionFactory">
                    <constructor-arg ref="internalTaskService" />
          </bean>


</beans>
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
mayank sahai
2013-04-04 09:52:27 UTC
Permalink
mayank sahai [https://community.jboss.org/people/mesa] created the discussion

"Re: Spring 3 & jBPM 5 & LocalTaskService"

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

--------------------------------------------------------------
Hi https://community.jboss.org/people/ehe888 Eric He;

did you manage to solve this ?. i am facing the same issue process instance info is persisted but humanTask details never make it to database
--------------------------------------------------------------

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

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