1 2 Previous Next 27 Replies Latest reply on Mar 18, 2009 12:53 PM by toriton

    Need help to fix timer issue

      Hi,
      I am trying to create a timer on a state node which works fine(with script) but once the timer is executed I want to move to next mail node and send a mail automatically. When I tried doing that mail is not sent. Also on the state node where I have the time configured if I try to specify actionHandler it is not getting executed.
      Can any one please help me since I am stuck for a while.
      Thanks in advance.
      Arunkumar

        • 1. Re: Need help to fix timer issue

          When I try to add action handler I am getting the following error:

          org.jbpm.graph.def.DelegationException
          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:382)
          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:585)
          at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
          at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$1ba96838.raiseException()
          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:373)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:276)
          at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
          at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
          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:585)
          at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
          at org.jbpm.graph.node.State$$EnhancerByCGLIB$$2029fa2.fireAndPropagateEvent()
          at org.jbpm.job.Timer.execute(Timer.java:48)
          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:585)
          at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
          at org.jbpm.job.Job$$EnhancerByCGLIB$$4d6de1ab.execute()
          at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
          at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
          Caused by: java.lang.NullPointerException
          at org.jbpm.graph.def.Action.execute(Action.java:122)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
          ... 17 more

          • 2. Re: Need help to fix timer issue
            gchanteb

            Could you show your file plz ?

            • 3. Re: Need help to fix timer issue


              I am using JBPM 3.2.3 and tomcat 5.5.20

              <state name="tsmactoncr" async="true">
              <event type="node-leave">
              <cancel-timer name="timer"></cancel-timer>
              </event>
              <timer duedate="7 seconds" name="timer" transition="to escalated">
              <script>
              System.out.println("escalatedr---::"+node.getName());
              node.leave(executionContext,"to escalated");
              </script>
              </timer>
              <transition to="normailflow" name="to normal flow"></transition>
              <transition to="escalationflow" name="to escalated"></transition>
              </state>
              


              I have a state node where I have a timer which is set for 7 seconds and transition set to "to escalated".
              I also have a script tag in which i have a node.leave("to escalated");.If I dont provide with the node.leave I see the SOP getting printed in a infinite loop.
              My requirement is if the timer is triggred and after 7 seconds I want to send a mail automatically for which I have a mail node and should take the transition"to escalated". if user acts on it in less than 7 seconds it should trigger a different transition say" normalflow"
              Thanks for your help in advance.
              Arunkumar

              • 4. Re: Need help to fix timer issue

                If I have a actionHandler insted of script the following error occurs:

                org.jbpm.graph.def.DelegationException
                 at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:382)
                 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:585)
                 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                 at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$ea1c8c52.raiseException(<generated>)
                 at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:373)
                 at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:276)
                 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:585)
                 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                 at org.jbpm.graph.node.State$$EnhancerByCGLIB$$d075c3bc.executeAction(<generated>)
                 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:585)
                 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                 at org.jbpm.job.Job$$EnhancerByCGLIB$$1be105c5.execute(<generated>)
                 at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
                 at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
                Caused by: java.lang.NullPointerException
                 at org.jbpm.graph.def.Action.execute(Action.java:122)
                 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:585)
                 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                 at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$33e1b16.execute(<generated>)
                 at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
                 ... 15 more
                
                



                • 5. Re: Need help to fix timer issue

                  My actionHandler contains

                  public void execute(ExecutionContext executionContext) throws Exception {
                   try {
                   System.out.println("It is not working...............");
                   } catch (Exception e) {
                   e.printStackTrace();
                   }
                  
                  


                  • 6. Re: Need help to fix timer issue
                    gchanteb

                    It works:

                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="process6">
                    
                     <start-state name="start-state1">
                     <transition to="tsmactoncr"></transition>
                     </start-state>
                    
                     <state name="tsmactoncr" async="true">
                     <timer name="timer" duedate="7 seconds" transition="to escalated">
                     <script>
                     System.out.println("escalatedr---::"+node.getName());
                     </script>
                     </timer>
                     <transition to="normailflow" name="to normal flow"></transition>
                     <transition to="escalationflow" name="to escalated"></transition>
                     </state>
                    
                     <state name="normailflow">
                     <event type="node-enter">
                     <script>
                     System.out.println("Node-enter: normailflow");
                     </script>
                     </event>
                     <transition to="end-state1"></transition>
                     </state>
                    
                     <state name="escalationflow">
                     <event type="node-enter">
                     <script>
                     System.out.println("Node-enter: escalationflow");
                     </script>
                     </event>
                     <transition to="end-state1"></transition>
                     </state>
                    
                     <end-state name="end-state1"></end-state>
                    
                    </process-definition>


                    • 7. Re: Need help to fix timer issue
                      gchanteb

                      And it works with action handler:

                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="process6">
                      
                       <start-state name="start-state1">
                       <transition to="tsmactoncr"></transition>
                       </start-state>
                      
                       <state name="tsmactoncr" async="true">
                       <timer name="timer" duedate="7 seconds" transition="to escalated">
                       <action class="yourpackage.Action1"></action>
                       </timer>
                       <transition to="normailflow" name="to normal flow"></transition>
                       <transition to="escalationflow" name="to escalated"></transition>
                       </state>
                      
                       <state name="normailflow">
                       <event type="node-enter">
                       <script>
                       System.out.println("Node-enter: normailflow");
                       </script>
                       </event>
                       <transition to="end-state1"></transition>
                       </state>
                      
                       <state name="escalationflow">
                       <event type="node-enter">
                       <script>
                       System.out.println("Node-enter: escalationflow");
                       </script>
                       </event>
                       <transition to="end-state1"></transition>
                       </state>
                      
                       <end-state name="end-state1"></end-state>
                      
                      </process-definition>


                      package yourpackage;
                      
                      import org.jbpm.graph.def.ActionHandler;
                      import org.jbpm.graph.exe.ExecutionContext;
                      
                      public class Action1 implements ActionHandler
                      {
                       private static final long serialVersionUID = 532619789299259672L;
                      
                       @Override
                       public void execute(ExecutionContext executionContext) throws Exception
                       {
                       for(int cpt=0;cpt<1000;cpt++)
                       {
                       System.out.println("Action 1: "+cpt);
                       }
                       }
                      }


                      • 8. Re: Need help to fix timer issue

                        It works fine
                        Thanks gchanteb.
                        But Instead if I have a timer on a state node and upon escalation I have to send a mail for which I need a task node or mail node or node and configure a Handler accordingly. If I try to have a actionHandler class I am able to see exception in JBPM_jobs table (DelegatoinException) and not able to proceed further. Can you help me in solving this issue.
                        Thanks in advance
                        Arunkumar

                        • 9. Re: Need help to fix timer issue

                          When I tried this solution with my application the SOP's are printed in a infinite loop and the process never ends. Any suggestion on this plz.
                          -Arunkumar

                          • 10. Re: Need help to fix timer issue
                            gchanteb

                            Sorry i'm french, i don't understand all your english. Could you try to re-explain again your other problem plz ? With code example and show what doesn't work now. ^^ Thx.

                            • 11. Re: Need help to fix timer issue

                              When I tried to have a actionHandler inside the timer It throws the following exception:


                              org.jbpm.graph.def.DelegationException
                              at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:382)
                              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:585)
                              at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                              at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$b2e1ca8f.raiseException()
                              at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:373)
                              at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:276)
                              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:585)
                              at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                              at org.jbpm.graph.node.State$$EnhancerByCGLIB$$993b01f9.executeAction()
                              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:585)
                              at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                              at org.jbpm.job.Job$$EnhancerByCGLIB$$e4a64402.execute()
                              at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
                              at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
                              Caused by: java.lang.NullPointerException
                              at org.jbpm.graph.def.Action.execute(Action.java:122)
                              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:585)
                              at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                              at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$cc035953.execute()
                              at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
                              ... 15 more

                              • 12. Re: Need help to fix timer issue
                                toriton

                                hello , i'm working on timers too, and the timer defined in the post before work fine for me.

                                I have a little problem after the timer execute the transition.

                                Imagine something as stateA have the timer, after 5 sec the timer go for transition to stateB ,do something , and then have to turn back in stateA restarting the timer itself.

                                I'm getting this exception when i try to do signal directly from the ActionHandler in stateB.

                                org.jbpm.JbpmException: this token is locked by token[5740]
                                


                                5740 is the ID of the state where the timer started, the stateA in the example described before.

                                Why i'm blocked from stateA? the process is not gone on in stateB with the timer?.
                                The transition used by the timer don't influence the process workflow?


                                Thanks in advance for any clarification.
                                T.





                                • 13. Re: Need help to fix timer issue

                                  For example plz conside the following:

                                  <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="process6">
                                  
                                   <start-state name="start-state1">
                                   <transition to="tsmactoncr"></transition>
                                   </start-state>
                                  
                                   <state name="tsmactoncr" async="true">
                                   <timer name="timer" duedate="7 seconds" transition="to escalated">
                                   <action class="yourpackage.Action1"></action>
                                   </timer>
                                   <transition to="normailflow" name="to normal flow"></transition>
                                   <transition to="escalationflow" name="to escalated"></transition>
                                   </state>
                                  
                                   <state name="normailflow">
                                   <event type="node-enter">
                                   <script>
                                   System.out.println("Node-enter: normailflow");
                                   </script>
                                   </event>
                                   <transition to="end-state1"></transition>
                                   </state>
                                  
                                   <task-node name="escalationflow">
                                   <task name="mail to customer" notify="true">
                                   <assignment class="yourcompany.MailAssignmentHandler"></assignment>
                                   </task>
                                   <transition to="end-state1" name="to-end1"></transition>
                                   </task-node>
                                  
                                   <end-state name="end-state1"></end-state>
                                  
                                  </process-definition>
                                  


                                  In above code I am trying to send a mail using task-node when the timer expires and it is escalation flow. when I try to have a AssignmentHandler it gives the Following Exception


                                  org.jbpm.graph.def.DelegationException
                                  at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:382)
                                  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:585)
                                  at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                                  at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$b2e1ca8f.raiseException()
                                  at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:373)
                                  at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:276)
                                  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:585)
                                  at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                                  at org.jbpm.graph.node.State$$EnhancerByCGLIB$$993b01f9.executeAction()
                                  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:585)
                                  at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                                  at org.jbpm.job.Job$$EnhancerByCGLIB$$e4a64402.execute()
                                  at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
                                  at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
                                  Caused by: java.lang.NullPointerException
                                  at org.jbpm.graph.def.Action.execute(Action.java:122)
                                  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:585)
                                  at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
                                  at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$cc035953.execute()
                                  at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
                                  ... 15 more



                                  Any clue.
                                  Thanks in advance
                                  -Arunkumar


                                  • 14. Re: Need help to fix timer issue
                                    gchanteb

                                    Arunkumar: Could you show the code of your MailAssignmentHandler ?

                                    1 2 Previous Next