1 Reply Latest reply on Sep 13, 2010 6:31 AM by mwohlf

    JBPM 4.4 and Spring 3

    dondragon2

      For days now I am struggling with this issue of integrating Spring 3 and JBPM 4.

       

      Apparently the application fails each time when I try to perform an action on one of the services, such as the repository service or the execution service.

      By doing form search I found out that there is a documented issue JBPM-2710.

       

      I have tried the solution as documented below.

       

      http://diversit.eu/2010/01/10/jbpm-4-3-with-spring

       

      still the problem persists. I tried to step through the code and I found that the issue is in the SpringTransactionIntercepter. Apparently no matter what I set in the jbpm.cfg.xml the transactionName is always null.

       

      JBPM CFG

      ===========

       

      <jbpm-configuration>
          <import resource="jbpm.default.cfg.xml" />
          <import resource="jbpm.tx.spring.cfg.xml" />
          <import resource="jbpm.jpdl.cfg.xml" />
          <import resource="jbpm.bpmn.cfg.xml" />
          <import resource="jbpm.identity.cfg.xml" />
          <import resource="jbpm.businesscalendar.cfg.xml" />
          <import resource="jbpm.console.cfg.xml" />
          <import resource="jbpm.jobexecutor.cfg.xml" />
          <process-engine-context>
          <!-- Default command service has a Spring transaction interceptor-->
              <command-service name="newTxRequiredCommandService">
                  <retry-interceptor />
                  <environment-interceptor policy="requiresNew" />
                  <spring-transaction-interceptor
      policy="requiresNew"  transaction-manager="hibernateTransactionManager" />
              </command-service>
              <command-service name="txRequiredCommandService">
                  <retry-interceptor />
                  <environment-interceptor />
                  <spring-transaction-interceptor transaction-manager="hibernateTransactionManager" />
              </command-service>
          </process-engine-context>
          <transaction-context>
              <transaction type="spring" />
              <hibernate-session current="true" />
          </transaction-context>
      <!--  <process-engine-context>
          <string name="spring.cfg" value="workflow.cfg.xml" />
        </process-engine-context>-->
      </jbpm-configuration>

      <jbpm-configuration>

       

          <import resource="jbpm.default.cfg.xml" />

          <import resource="jbpm.tx.spring.cfg.xml" />

          <import resource="jbpm.jpdl.cfg.xml" />

          <import resource="jbpm.bpmn.cfg.xml" />

          <import resource="jbpm.identity.cfg.xml" />

          <import resource="jbpm.businesscalendar.cfg.xml" />

          <import resource="jbpm.console.cfg.xml" />

          <import resource="jbpm.jobexecutor.cfg.xml" />

       

          <process-engine-context>

          <!-- Default command service has a Spring transaction interceptor-->

              <command-service name="newTxRequiredCommandService">

                  <retry-interceptor />

                  <environment-interceptor policy="requiresNew" />

                  <spring-transaction-interceptor

      policy="requiresNew"  transaction-manager="hibernateTransactionManager" />

              </command-service>

       

              <command-service name="txRequiredCommandService">

                  <retry-interceptor />

                  <environment-interceptor />

                  <spring-transaction-interceptor transaction-manager="hibernateTransactionManager" />

              </command-service>

          </process-engine-context>

       

          <transaction-context>

              <transaction type="spring" />

              <hibernate-session current="true" />

          </transaction-context>

       

      </jbpm-configuration>

       

       

       

      Spring Config

      =================

       

      <?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:context="http://www.springframework.org/schema/context"

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

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

       

       

          <context:annotation-config />

          <context:component-scan base-package="com.cavet.core.jbpm"/>

       

          <bean id="jbpmSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

              <property name="dataSource" ref="dataSource"/>

              <property name="mappingResources">

                  <list>

                      <value>jbpm.repository.hbm.xml</value>

                      <value>jbpm.execution.hbm.xml</value>

                      <value>jbpm.history.hbm.xml</value>

                      <value>jbpm.task.hbm.xml</value>

                      <value>jbpm.identity.hbm.xml</value>

                  </list>

              </property>

              <property name="hibernateProperties">

                  <props>

                      <prop key="hibernate.dialect">${hibernate.dialect}</prop>

                      <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>

                      <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>

                  </props>

              </property>

          </bean>

       

       

          <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">

              <property name="sessionFactory" ref="jbpmSessionFactory" />

              <property name="dataSource" ref="dataSource" />

          </bean>

       

      </beans>

       

       

      Class

      =============

      ...

       

        @Autowired

          @Qualifier("jbpmExecutionService")

          private ExecutionService executionService;

       

      ...

       

      executionService.startProcessInstanceByKey(name, variables); <----nothing happens here and in the spring intercepter

       

      Please help me in trying to resolve this. Thanks

        • 1. Re: JBPM 4.4 and Spring 3
          mwohlf

          Hi Donald,

          as far as I remember spring integration changed slightly between 4.3 and 4.4 your best option is to take a look at the testcases in jBPM4 there are some for the spring integration. Spring3 is not covered yet but for me it works without changes whether it is 2.5 or 3.