3 Replies Latest reply on Aug 19, 2010 8:00 PM by rebody

    Error after Event.notify

    darkit

      Good day,

       

      I'm integrating JBPM 4.4 in our project (resteasy + spring 3).

       

      I have simple state:

       

       

      <state g="120,135,100,80" name="new">
              <on event="start">
                  <event-listener expr="#{externalResourceService}">
                      <field name="url">
                          <string value="http://localhost:8080/rest/"/>
                      </field>
                      <field name="toSave">
                          <list>
                              <string name="name" value="name"/>
                              <int name="age" value="1"/>
                          </list>
                      </field>
                  </event-listener>
              </on>
              <transition name="to approve" to="approve" g="-62,-19"/>
          </state>

       

      And spring bean for this even:

       

      @Service("externalResourceService")

      public class ExternalResourceService implements EventListener {

          public static final Logger log = Logger.getLogger(ExternalResourceService.class);

       

          String url;

          List toSave;

       

          @Autowired

          @Qualifier("executionService")

          private ExecutionService executionService;

       

          public void notify(final EventListenerExecution execution) throws Exception {

              System.out.println("Name:" +execution.getName());

              System.out.println("Existed variables: "+execution.getVariables());

              System.out.println("URL: "+url);

              System.out.println("toSave: "+toSave);

              executionService.signalExecutionById(execution.getId(), "to approve");

          }

      }

       

      This state is first element in process definition and when I start new process instance my code works as expected but then I get such error:

       

      java.lang.IllegalArgumentException: id to load is required for loading

      at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:51)

      at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:33)

      at org.hibernate.impl.SessionImpl.load(SessionImpl.java:792)

      at org.hibernate.impl.SessionImpl.load(SessionImpl.java:788)

      at org.jbpm.pvm.internal.history.events.ActivityEnd.process(ActivityEnd.java:50)

      at org.jbpm.pvm.internal.history.HistorySessionImpl.process(HistorySessionImpl.java:31)

      at org.jbpm.pvm.internal.history.HistoryEvent.fire(HistoryEvent.java:67)

      at org.jbpm.pvm.internal.model.ExecutionImpl.historyActivityEnd(ExecutionImpl.java:1164)

      at org.jbpm.jpdl.internal.activity.StateActivity.signal(StateActivity.java:72)

      at org.jbpm.jpdl.internal.activity.StateActivity.signal(StateActivity.java:49)

      at org.jbpm.pvm.internal.model.op.Signal.perform(Signal.java:70)

      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:672)

      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:632)

      at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:217)

      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:63)

      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:36)

      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)

      at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)

      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)

      at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)

      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:71)

      at com.my.workflow.service.impl.ProcessService.start(ProcessService.java:27)

       

      If I remove event listener from process definition then everything's OK and there're no any errors.