0 Replies Latest reply on Feb 12, 2009 3:24 PM by Luc Dew

    jBPM issues with timers and jobs

    Luc Dew Newbie

      Hi, i have issues with Seam and jBPM integration with timers and jobs.
      I created in a jBPM workflow a task that launches a timer :


      <state name="waitForAdminMail">
          <event type="timer-create">
            <action name="timerCreated" class="com.rtw.web.bpm.ChangeDueDateActionHandler">
              <timerName>varTimer</timerName>
              <delay>#{adminDueDate}</delay>
            </action>
          </event>
          <timer duedate="10 years" name="varTimer" transition="fired">
            <action name="message" expression="#{registration.sendAdminApproval()}">  
            </action>
          </timer>
          <!-- exception-handler exception-class=""></exception-handler -->
          <transition to="end" name="isMailSent"></transition>
          <transition to="end" name="notFired"></transition>
      </state>



      The timer is executed by the JobExecutor thread started by a servlet.



      <servlet>
          <servlet-name>JobExecutorServlet</servlet-name>
          <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
      </servlet>



      But i have 2 issues with this :



      • the action sendAdminApproval is executed twice. I put a debugger and it turns out that the SeamExpressionEvaluator evals the expression as both a MethodExpression and a ValueExpression. So it's executed twice. It does not happen when the jBPM token is started from a Seam component.

      • I got exceptions in my stack trace (and the process does not return its initial state) This error seems to be more related to jBPM :




      javax.el.ELException: org.jbpm.JbpmException: couldn't delete jobs for 
      org.jbpm.graph.exe.ProcessInstance@f1a77
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
           at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
           at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at org.jboss.seam.bpm.SeamExpressionEvaluator$1.evaluate(SeamExpressionEvaluator.java:92)
           at org.jboss.seam.bpm.SeamExpressionEvaluator.evaluate(SeamExpressionEvaluator.java:45)
           at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:39)
           at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:30)
           at org.jbpm.graph.def.Action.execute(Action.java:118)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.graph.def.Action_$$_javassist_40.execute(Action_$$_javassist_40.java)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor$1.process(SeamUserCodeInterceptor.java:80)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor$ContextualCall.run(SeamUserCodeInterceptor.java:40)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor.executeAction(SeamUserCodeInterceptor.java:74)
           at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:257)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.graph.node.State_$$_javassist_80.executeAction(State_$$_javassist_80.java)
           at org.jbpm.job.Timer.execute(Timer.java:56)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.job.Job_$$_javassist_90.execute(Job_$$_javassist_90.java)
           at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
           at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
      Caused by: org.jbpm.JbpmException: couldn't delete jobs for 'org.jbpm.graph.exe.ProcessInstance@f1a77'
           at org.jbpm.db.JobSession.deleteJobsForProcessInstance(JobSession.java:210)
           at org.jbpm.scheduler.db.DbSchedulerService.deleteTimersByProcessInstance(DbSchedulerService.java:54)
           at org.jbpm.graph.exe.ProcessInstance.end(ProcessInstance.java:329)
           at org.jbpm.graph.exe.Token.notifyParentOfTokenEnd(Token.java:329)
           at org.jbpm.graph.exe.Token.end(Token.java:301)
           at org.jbpm.graph.exe.Token.end(Token.java:251)
           at org.jbpm.graph.node.EndState.execute(EndState.java:59)
           at org.jbpm.graph.def.Node.enter(Node.java:318)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.graph.def.Node_$$_javassist_86.enter(Node_$$_javassist_86.java)
           at org.jbpm.graph.def.Transition.take(Transition.java:151)
           at org.jbpm.graph.def.Node.leave(Node.java:393)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.graph.def.Node_$$_javassist_86.leave(Node_$$_javassist_86.java)
           at org.jbpm.graph.exe.Token.signal(Token.java:192)
           at org.jbpm.graph.exe.Token.signal(Token.java:155)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
           at org.jbpm.graph.exe.Token_$$_javassist_22.signal(Token_$$_javassist_22.java)
           at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:282)
           at org.jboss.seam.bpm.BusinessProcess.transition(BusinessProcess.java:235)
           at org.jboss.seam.bpm.BusinessProcessInterceptor.afterInvocation(BusinessProcessInterceptor.java:130)
           at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at com.rtw.web.action.RegistrationProcessAction_$$_javassist_5.sendAdminApproval(RegistrationProcessAction_$$_javassist_5.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
           ... 35 more
      Caused by: org.hibernate.TransactionException: could not register synchronization
           at org.hibernate.transaction.JTATransaction.registerSynchronization(JTATransaction.java:309)
           at org.jbpm.db.JobSession.deleteJobsForProcessInstance(JobSession.java:207)
           ... 80 more
      Caused by: java.lang.NullPointerException
           at org.hibernate.transaction.JTATransaction.registerSynchronization(JTATransaction.java:306)
           ... 81 more




      Has anybody managed to use jBPM jobs and timers with Seam ?


      Seam : 2.1.0.sp1
      JBoss : 4.2.3
      jBPM-jpdl: 3.2.3


      Thanks in advance
      Luc