首页 > 其他分享 >Spring 3 & jBPM 5 & LocalTaskService

Spring 3 & jBPM 5 & LocalTaskService

时间:2023-05-16 11:32:09浏览次数:42  
标签:insert Task jBPM -- Spring LocalTaskService sqlserver jdbc


帖子地址:[url]https://community.jboss.org/thread/195386[/url]

Hi Guys,

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

I am using [color=red][b]Spring 3.0, JBPM 5.4.0.Final, Drools 5.5.0.Final[/b][/color]

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>

标签:insert,Task,jBPM,--,Spring,LocalTaskService,sqlserver,jdbc
From: https://blog.51cto.com/u_3871599/6282994

相关文章

  • springboot 整合webservice 相关说明
    1.环境依赖jdk8,springboot2.3.12.release,cxf版本需要根据springboot版本修改,方法:查看springboot版本的发布日期,然后根据日期找相近的两个版本<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId><versi......
  • Spring中实现文件上传
    一些问题:springmvc文件上传,使用它的MultipartHttpServletRequest,tomcat中正常,resion中报错[url]http://zhupan.iteye.com/blog/26427[/url]实现图片上传用户必须能够上传图片,因此需要文件上传的功能。比较常见的文件上传组件有CommonsFileUpload(htt......
  • SpringIOC和SpringAOP
    作为一个Spring使用者条件:拥有深入的Spring框架知识和开发经验,能够熟练地运用Spring框架来构建复杂的应用程序。了解Spring框架的核心概念和设计思想,如控制反转(IoC)、依赖注入(DI)、面向切面编程(AOP)等,并能灵活运用这些概念来解决实际问题。熟悉Spring框架中各个模块的功能和用法,如......
  • SpringMVC快速复习(超详细)
    目录一、SpringMVC简介1、什么是MVC2、什么是SpringMVC3、SpringMVC的特点二、HelloWorld1、开发环境2、创建maven工程a>添加web模块b>打包方式:warc>引入依赖3、配置web.xmla>默认配置方式b>扩展配置方式4、创建请求控制器5、创建springMVC的配置文件6、测试HelloWorlda>实现对首......
  • springboot(8)--定制服务
    springboot的服务配置除了application.properties,还可以通过implements WebServerFactoryCustomizer<T>定制服务,例如指定容器,端口,协议等等我们只要在继承类中添加自己的配置即可*@ClassnameTomcatServerConfiger*@CreatedbyMichael*@Date2023/5/15*@Descriptio......
  • 四、SpringCloud Alibaba搭建Nacos集群
    Nacos定义为一个IDC内部应用组件,并非面向公网环境的产品,建议在内部隔离网络环境中部署,强烈不建议部署在公共网络环境。Nacos支持三种部署模式单机模式-用于测试和单机试用。集群模式-用于生产环境,确保高可用。多集群模式-用于多数据中心场景。单机模式下运行NacosLi......
  • Spring的PropertyPlaceholderConfigurer应用
    1.PropertyPlaceholderConfigurer是个bean工厂后置处理器的实现,也就是BeanFactoryPostProcessor接口的一个实现。PropertyPlaceholderConfigurer可以将上下文(配置文件)中的属性值放在另一个单独的标准javaProperties文件中去。在XML文件中用${key}替换指定的properties文件中的值......
  • SpringBoot发布https服务
    一、生成SSL证书 1、进入本地jdk的路径cdD:\Program\jdk1.8.0_77\jre\lib\securitycmd窗口生成证书HSoftTiger.keystore到D盘keytool-genkey-aliastigerCompany-keyalgRSA-keysize1024-keypasstigerpass-validity3650-keystoreD:\HSoftTiger.keystore-storep......
  • Spring源码:Bean生命周期(四)
    前言在之前的文章中,我们介绍了Bean的核心概念、Bean定义的解析过程以及Bean创建的准备工作。在今天的文章中,我们将深入探讨Bean的创建过程,并主要讲解createBean方法的实现。在这个过程中,我们将了解Bean的实例化、属性注入、初始化和销毁等步骤,以及各个步骤的具体实现......
  • Tomcat10依赖问题 jakarta.servlet-api 6.0.0 spring6.x.x
    org.springframework.web.servlet.DispatcherServlet’isnotassignabletojavax.servlet.Servlet1、pom.xml配置<dependency><groupId>jakarta.servlet</groupId><artifactId>jakarta.servlet-api</artifact......