0 Replies Latest reply on Mar 4, 2010 5:44 AM by seanmo

    Repeat Timer Issue

      This happened on jBPM 4.0. Initially I defined a normal timer in my process definition, it worked well but after I changed it to a repeat timer (by adding repeat="30 seconds"), I encountered the following exception:

       

      ar 4, 2010 5:40:35 PM org.jbpm.internal.log.Jdk14Log error

      SEVERE: exception while executing 'timer[23|2010-03-04 17:41:05,391|TimeoutEvent]'

      org.jbpm.api.JbpmException

       

       

      : no transaction in environment

      at org.jbpm.pvm.internal.job.TimerImpl.execute(

       

      TimerImpl.java:150)

      at org.jbpm.pvm.internal.job.TimerImpl.execute(

       

      TimerImpl.java:52)

      at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(

       

      ExecuteJobCmd.java:74)

      at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(

       

      ExecuteJobCmd.java:41)

      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(

       

      DefaultCommandService.java:42)

      at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(

       

      CommandTransactionCallback.java:50)

      at org.springframework.transaction.support.TransactionTemplate.execute(

       

      TransactionTemplate.java:128)

      at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(

       

      SpringTransactionInterceptor.java:79)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(

       

      EnvironmentInterceptor.java:54)

      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(

       

      RetryInterceptor.java:55)

      at org.jbpm.pvm.internal.jobexecutor.JobExecutorThread.run(

       

      JobExecutorThread.java:63)

       

      Here's my timer definition:

       

      <

       

      <custom expr="#{customWaitActivity}" name="Custom Wait" g="411,174,126,52">

       

      <on event="TimeoutEvent">

       

      <!--<timer duedate="30 seconds" />-->

       

      <timer duedate="30 seconds" repeat="30 seconds" />

       

      <event-listener class="jbpm.demo.wf.spring.SpringEventListenerDelegate">

       

      <field name="beanName">

       

      <string value="timerExpireHandler" />

       

      </field>

       

      </event-listener>

       

      </on>

       

      <transition name="timeout" to="Do Something" g="47,-8" >

       

      <timer duedate="7 business days"></timer>

       

      </transition>

       

      </custom>

       

      Spring is used to control all the transactions in my project. All the other functions work fine so I think this may be a Spring integration bug of Timer. Here's my Sping Transaction config:

       

      <

      <

      <tx:annotation-driven transaction-manager="transactionManager" />

       

       

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

       

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

       

      </bean>

       

       

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

       

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

       

      <property name="exposeTransactionAwareSessionFactory"><value>true</value></property>

       

      <property name="hibernateProperties">

       

      <props>

       

      <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>

       

      <prop key="hibernate.format_sql">false</prop>

       

      <prop key="hibernate.show_sql">false</prop>

       

      <prop key="use_sql_comments">false</prop>

       

      <prop key="hibernate.hbm2ddl.auto">none</prop>

       

      </props>

       

      </property>

       

      <property name="mappingLocations">

       

      <list>

       

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

       

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

       

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

       

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

       

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

       

      </list>

       

      </property>

       

      </bean>

       

      And jbpm.cfg.xml is properly set up according to the jbpm doc as below.

      ...

      <

       

      <job-executor threads="2" idle="20000" lock="2400000" auto-start="true" init="immediate" />

       

       

      <!-- Here we needed to change the transaction interceptor -->

       

      <command-service>

       

      ...

       

      <spring-transaction-interceptor />

       

      </command-service>

       

       

      <!-- Added spring as read-context -->

       

      <script-manager default-expression-language="juel" default-script-language="juel"

       

      read-contexts="execution, environment, process-engine, spring" write-context="">

       

      <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />

       

      </script-manager>

       

       

      ...

       

       

      <transaction-context>

       

      ...

       

      <hibernate-session current="true" />

       

      </transaction-context>

      ...

       

      Could anyone help to take a look? Thank you very much in advance!

      at org.jbpm.pvm.internal.job.TimerImpl.execute(