<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Spring 3 & jBPM 5 & LocalTaskService
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/ehe888">Eric He</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/780782#780782">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi Guys,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am also struggling in config Spring + Local Human Task.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am using Spring 3.0, JBPM 5.4.0.Final, Drools 5.5.0.Final</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I can config to use JTA and Non-JTA, both can run in Spring container in my test case, but the only issue:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The human task never got insert into database, I can get ProcessInstance and Workitem inserted. </p><p>But I never see any "insert into Task"  sql statement in console.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I don't know why the task not got insert. Does anybody have the same issue?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>My Spring Config as below</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><span><beans xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>"</span></p><p><span>          xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns:drools="</span><a class="jive-link-external-small" href="http://drools.org/schema/drools-spring" target="_blank">http://drools.org/schema/drools-spring</a><span>"</span></p><p><span>          xmlns:context="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a><span>" xmlns:tx="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span>"</span></p><p><span>          xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-3.0.xsd</a></p><p><span>               </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" target="_blank">http://www.springframework.org/schema/tx/spring-tx-3.0.xsd</a><span>   </span></p><p><span>               </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context/spring-context-3.0.xsd" target="_blank">http://www.springframework.org/schema/context/spring-context-3.0.xsd</a><span>      </span></p><p><span>               </span><a class="jive-link-external-small" href="http://drools.org/schema/drools-spring" target="_blank">http://drools.org/schema/drools-spring</a><span> org/drools/container/spring/drools-spring-1.2.0.xsd"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <context:annotation-config /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <tx:annotation-driven transaction-manager="transactionManager"</p><p>                    proxy-target-class="true" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <context:component-scan base-package="com.my.jbpm.test" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="basicdataSource" class="org.apache.commons.dbcp.BasicDataSource"></p><p>                    <property name="driverClassName"></p><p>                              <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value></p><p>                    </property></p><p>                    <property name="url"></p><p>                              <value>jdbc:sqlserver://localhost:1433;databaseName=jbpm5</value></p><p>                    </property></p><p>                    <property name="username"></p><p>                              <value>sa</value></p><p>                    </property></p><p>                    <property name="password"></p><p>                              <value>123456</value></p><p>                    </property></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="xadataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"</p><p>                    init-method="init" destroy-method="close"></p><p>                    <property name="className"</p><p>                              value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" /></p><p>                    <property name="uniqueName" value="jdbc/jbpm-ds" /></p><p>                    <property name="minPoolSize" value="1" /></p><p>                    <property name="maxPoolSize" value="5" /></p><p>                    <property name="allowLocalTransactions" value="true" /></p><p>                    <property name="driverProperties"></p><p>                              <props></p><p>                                        <prop key="URL">jdbc:sqlserver://localhost:1433;databaseName=jbpm5</p><p>                                        </prop></p><p>                                        <prop key="user">sa</prop></p><p>                                        <prop key="password">123456</prop></p><p>                              </props></p><p>                    </property></p><p>          </bean></p><p>  </p><p>          <bean id="entityManagerFactory"</p><p>                    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"></p><p>                    <property name="dataSource" ref="xadataSource" /></p><p>                    <property name="persistenceUnitName" value="org.jbpm.persistence.jpa" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <!-- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> </p><p>                    <property name="entityManagerFactory" ref="entityManagerFactory" /> <property </p><p>                    name="nestedTransactionAllowed" value="true" /> </bean> --></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="btmConfig" factory-method="getConfiguration"</p><p>                    class="bitronix.tm.TransactionManagerServices"></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="BitronixTransactionManager" factory-method="getTransactionManager"</p><p>                    class="bitronix.tm.TransactionManagerServices" depends-on="xadataSource,transactionManager"</p><p>                    destroy-method="shutdown" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="transactionManager"</p><p>                    class="org.springframework.transaction.jta.JtaTransactionManager"></p><p>                    <property name="transactionManager" ref="BitronixTransactionManager" /></p><p>                    <property name="userTransaction" ref="BitronixTransactionManager" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <!-- <bean id="droolsTransactionManager"</p><p>                    class="org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager"></p><p>                    <constructor-arg name="ptm" ref="transactionManager" /></p><p>          </bean> --></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <drools:grid-node id="node1" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <drools:resource id="resource1" type="BPMN2"</p><p>                    source="classpath:Evaluation.bpmn" /></p><p>          <drools:resource id="intfly_quotation" type="BPMN2"</p><p>                    source="classpath:com.intfly.Quotation.bpmn" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <drools:kbase id="kbase1" node="node1"></p><p>                    <drools:resources></p><p>                              <drools:resource ref="resource1" /></p><p>                              <drools:resource ref="intfly_quotation" /></p><p>                    </drools:resources></p><p>          </drools:kbase></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <drools:ksession id="ksession" type="stateful" kbase="kbase1"</p><p>                    node="node1"></p><p>                    <drools:configuration></p><p>                              <drools:work-item-handlers></p><p>                                        <drools:work-item-handler name="ServiceStepComplete"</p><p>                                                  ref="ServiceStepCompleteHandler" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>                              </drools:work-item-handlers></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>                              <drools:jpa-persistence></p><p>                                        <drools:transaction-manager ref="transactionManager" /></p><p>                                        <drools:entity-manager-factory ref="entityManagerFactory" /></p><p>                              </drools:jpa-persistence></p><p>                    </drools:configuration></p><p>          </drools:ksession></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="ServiceStepCompleteHandler" class="ServiceStepCompleteHandler" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="emailHandler" class="org.jbpm.process.workitem.email.EmailWorkItemHandler"></p><p>                    <constructor-arg name="host"></p><p>                              <value>smtp.gmail.com</value></p><p>                    </constructor-arg></p><p>                    <constructor-arg name="port"></p><p>                              <value>587</value></p><p>                    </constructor-arg></p><p>                    <constructor-arg name="userName"></p><p><span>                              <value></span><a class="jive-link-email-small" href="mailto:eric.leihe@gmail.com" target="_blank">eric.leihe@gmail.com</a><span></value></span></p><p>                    </constructor-arg></p><p>                    <constructor-arg name="password"></p><p>                              <value>310106781127283</value></p><p>                    </constructor-arg></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <!-- <bean id="HumanTaskHander" class="org.jbpm.process.workitem.wsht.HornetQHTWorkItemHandler"> </p><p>                    <constructor-arg> <ref local="ksession" /> </constructor-arg> <property name="ipAddress" </p><p>                    value="127.0.0.1" /> <property name="port" value="10101" /> </bean> --></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="sessionWrapper" class="com.my.jbpm.KSessionWrapper"</p><p>                    init-method="init" depends-on="ksession, internalTaskService"/></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory"</p><p>                    factory-method="getSystemEventListener" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="userInfo" class="JpaUserInfoImpl" /></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="escalatedDeadlineHandler" class="org.jbpm.task.service.DefaultEscalatedDeadlineHandler"></p><p>                    <property name="userInfo" ref="userInfo" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="internalTaskService" class="org.jbpm.task.service.TaskService"></p><p>                    <property name="systemEventListener" ref="systemEventListener" /></p><p>                    <property name="escalatedDeadlineHandler" ref="escalatedDeadlineHandler" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="htTxManager"</p><p>                    class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager"></p><p>                    <constructor-arg ref="transactionManager" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="springTaskSessionFactory"</p><p>                    class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl"</p><p>                    init-method="initialize" depends-on="internalTaskService"></p><p>                    <property name="entityManagerFactory" ref="entityManagerFactory" /></p><p>                    <property name="transactionManager" ref="htTxManager" /></p><p>                    <property name="useJTA" value="true" /></p><p>                    <property name="taskService" ref="internalTaskService" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          <bean id="taskService" class="org.jbpm.task.service.local.LocalTaskService"</p><p>                    depends-on="springTaskSessionFactory"></p><p>                    <constructor-arg ref="internalTaskService" /></p><p>          </bean></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p></beans></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/780782#780782">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>