[jboss-user] [jBPM] New message: "Using timers when integrating jBPM4.2 with Spring 2.5.6"

Andrius Miasnikovas do-not-reply at jboss.com
Mon Feb 8 06:13:23 EST 2010


User development,

A new message was posted in the thread "Using timers when integrating jBPM4.2 with Spring 2.5.6":

http://community.jboss.org/message/524727#524727

Author  : Andrius Miasnikovas
Profile : http://community.jboss.org/people/andriusms

Message:
--------------------------------------------------------------
Hi,
 
I'm using JDK 1.6.0.18 and integrated jBPM 4.2 with Spring  2.5.6 in a web application that runs on Liferay portal. JBPM tables are in the same database with the tables for the application domain. The user influences the process by interacting with the application and when my service layer gets called Spring annotated service methods propagate the transaction and jbpm events become part of the transaction and either everything goes well or everything gets rolled back. Also the jbpm event implementations have access to the dao layer to modify the application domain. My problem is that some of the process states have timers with repeat attributes which aren't working well for me.
 
<state name="do-something">
  <on event="timeout">
    <timer duedate="5 business seconds" repeat="5 business seconds" />
    <event-listener auto-wire="true" class="process.SomeEvent"/>
  </on>
  <transition name="proceed" to="next-state"/>
  <transition name="giveup" to="fallback-state"/>
</state>
 
The wayI understand it jobexecutor calls the timeout events at a later time in a newly created transaction. When I look at the logs I can see that the event executed and hibernated updated my domain objects in the database, but then some internal jbpm exception is thrown and the whole transaction gets rolled back. I've been at it for a few days now and can't understand what I'm doing wrong. Here's the configuration for the jbpm that I'm using
 
<?xml version="1.0" encoding="UTF-8"?>
 
<jbpm-configuration xmlns="http://jbpm.org/4.2/cfg">
    <process-engine-context>
 
        <repository-service />
        <repository-cache />
        <execution-service />
        <history-service />
        <management-service />
        <task-service />
 
        <script-manager default-expression-language="juel" default-script-language="juel" read-contexts="execution, environment, process-engine, spring" write-contexts="">
            <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
        </script-manager>
 
        <types resource="jbpm.variable.types.xml" />
        <address-resolver />
 
        <command-service name="txRequiredCommandService">
            <skip-interceptor />
            <retry-interceptor />
            <environment-interceptor />
            <spring-transaction-interceptor/>
        </command-service>
 
        <command-service name="newTxRequiredCommandService">
            <retry-interceptor />
            <environment-interceptor policy="requiresNew" />
            <spring-transaction-interceptor/>
        </command-service>
 
        <job-executor command-service="newTxRequiredCommandService" />
 
        <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
            <field name="commandService">
                <ref object="newTxRequiredCommandService" />
            </field>
        </object>
 
        <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
 
        <deployer-manager>
            <jpdl-deployer />
        </deployer-manager>
 
        <business-calendar>
            <monday    hours="7:00-20:00"/>
            <tuesday   hours="7:00-20:00"/>
            <wednesday hours="7:00-20:00"/>
            <thursday  hours="7:00-20:00"/>
            <friday    hours="7:00-20:00"/>
        </business-calendar>
    </process-engine-context>
 
    <transaction-context>
        <repository-session />
        <db-session />
        <message-session />
        <timer-session />
        <history-session />
        <mail-session>
            <mail-server>
                <session-properties resource="jbpm.mail.properties" />
            </mail-server>
        </mail-session>
        <hibernate-session current="true" />
    </transaction-context>
 
</jbpm-configuration>
 
Is there something wrong with it? Maybe I'm just not seeing straight anymore. The timer calls my event which does its work and then moves to another state which does something else and changes the database, I've been debugging what happens next and the jbpm's TimerImpl class checks if repeat attirbute is set (in my case - it is) schedules a new due date, releases the lock on the timer and executes the following code
 
JobExecutor jobExecutor = environment.get(JobExecutor.class);
      if (jobExecutor!=null) {
        Transaction transaction = environment.get(Transaction.class);
        if (transaction==null) {
          throw new JbpmException("no transaction in environment");
        }
....
 
here it fails to retrieve the new transaction and because it is null an exception is thrown and the transaction with all of my changes gets rolled back. It would seem that I'm misconfiguring something because the jobexecutor cannot retrieve the transaction but it did execute the event. Did someone ran into something similar or knows how to fix this?

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/524727#524727




More information about the jboss-user mailing list