JBoss Community

Re: Spring 3 & jBPM 5 & LocalTaskService

created by Eric He in jBPM - View the full discussion

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>eric.leihe@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

Start a new discussion in jBPM at Community