1 2 Previous Next 16 Replies Latest reply: Oct 22, 2013 6:59 AM by Muzammil Shaikh RSS

Spring 3 & jBPM 5 & LocalTaskService

John Bize Newbie

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.

  • 1. Re: Spring 3 & jBPM 5 & LocalTaskService
    nwhiteside Newbie

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

  • 2. Re: Spring 3 & jBPM 5 & LocalTaskService
    John Bize Newbie

    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.

  • 3. Re: Spring 3 & jBPM 5 & LocalTaskService
    Maciej Swiderski Master

    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

  • 4. Re: Spring 3 & jBPM 5 & LocalTaskService
    John Bize Newbie

    Maciej,

     

    I appreciate your responding to 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

  • 5. Re: Spring 3 & jBPM 5 & LocalTaskService
    Maciej Swiderski Master

    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

  • 6. Re: Spring 3 & jBPM 5 & LocalTaskService
    John Bize Newbie

    Thanks so much... Standing by.

  • 7. Re: Spring 3 & jBPM 5 & LocalTaskService
    Ted Pan Newbie

    I can provide you a sample as soon as this issue got fixed 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

  • 8. Re: Spring 3 & jBPM 5 & LocalTaskService
    Maciej Swiderski Master

    John, managed to find bit of time and start working on spring and jbpm example, you can find it 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

  • 9. Re: Spring 3 & jBPM 5 & LocalTaskService
    John Bize Newbie

    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

  • 10. Re: Spring 3 & jBPM 5 & LocalTaskService
    Maciej Swiderski Master

    John Bize wrote:

     

    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...

     

     

    John Bize wrote:

    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.

     

     

    John Bize wrote:

    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

  • 11. Re: Spring 3 & jBPM 5 & LocalTaskService
    John Bize Newbie

    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

  • 12. Re: Spring 3 & jBPM 5 & LocalTaskService
    Maciej Swiderski Master

    John, droolsjbpm-integration should be at the same level as drools - 5.5.0

     

    John Bize wrote:

     

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

    at the moment yes, but from 6 they will be aligned.

     

    HTH

  • 13. Re: Spring 3 & jBPM 5 & LocalTaskService
    suresh p Newbie

    Hi Maciej ,

     

    Could you please complete this example ?

     

    Thanks

  • 14. Re: Spring 3 & jBPM 5 & LocalTaskService
    Eric He Newbie

    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"

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:drools="http://drools.org/schema/drools-spring"

              xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"

              xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  

                   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd     

                   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></value>

                        </constructor-arg>

                        <constructor-arg name="password">

                                  <value></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>

1 2 Previous Next