4 Replies Latest reply on Oct 1, 2009 8:13 AM by Ronald van Kuijk

    cannot be cast to org.jbpm.graph.def.ActionHandler

    Sascha Janz Master

      i got a simple class implementing the actionhandler.

      but when i try to execute it i got

      WaitAndSignal cannot be cast to org.jbpm.graph.def.ActionHandler

      code is

      
      import org.jbpm.graph.def.ActionHandler;
      import org.jbpm.graph.exe.ExecutionContext;
      
      
      public class WaitAndSignal implements ActionHandler{
      
       private final static long serialVersionUID=1l;
      
       public void execute(ExecutionContext executionContext) throws Exception {
       // TODO Auto-generated method stub
       try {
       System.out.println("Begin WaitAndSignal");
       long dauer = System.currentTimeMillis()% 100000;
       Thread.sleep(dauer);
       executionContext.getProcessInstance().signal();
       System.out.println("pid is = " +executionContext.getProcessInstance().getId() );
       }
       catch(Exception e ) {
       e.printStackTrace();
       }
       System.out.println("end WaitAndSignal");
      
       }
      
       int wait =100;
      
       public int getWait() {
       return wait;
       }
      
       public void setWait(int wait) {
       this.wait = wait;
       }
      
      }
      



      the processdefinition is

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="autokette">
      
      
       <start-state name="start-state1">
       <transition to="node1"></transition>
       <event type="node-enter">
       <action name="weiter" class="mypackage.WaitAndSignal" ></action>
       </event>
       </start-state>
      
      
       <node name="node1">
       <transition to="node2"></transition>
       <event type="node-enter">
       <action name="weiter" class="mypackage.WaitAndSignal" ></action>
       </event>
      
       </node>
      
       <node name="node2">
       <transition to="node3"></transition>
       <event type="node-enter">
       <action name="weiter" class="mypackage.WaitAndSignal" ></action>
       </event>
      
       </node>
      
       <node name="node3">
       <transition to="end-state1">
       </transition>
       <event type="node-enter">
       <action name="weiter" class="mypackage.WaitAndSignal" ></action>
       </event>
      
       </node>
      
      
       <end-state name="end-state1"></end-state>
      
      
      </process-definition>