0 Replies Latest reply on Jun 28, 2006 1:21 PM by Sam ja

    Creating Timer from program

    Sam ja Newbie

      Hi,
      I am trying to create timer programatically.
      But I am getting class cast exception when registring the action for timer.

      CreateTimerAction cta = new CreateTimerAction();
       cta.setTimerName("myTimer");
      
       cta.setDueDate("1 minutes");
       cta.setTransitionName("myTransition" );
      
       Action action = null;
       String actionName = "MydActionHandler";
       Class actionType = ClassLoaderUtil.getClassLoader().loadClass(actionName);
       try {
      
       action = (org.jbpm.graph.def.Action) actionType.newInstance()
       cta.setTimerAction(action);
       } catch (Exception e) {
       log.error("error msgs = "+e.toString());
      
       }


      the log is as follows
      couldn't instantiate action 'com.TrialActions.SecondActionHandler', of type 'com.TrialActions.SecondActionHandler'
      java.lang.ClassCastException
       at com.TrialActions.InJoinActionHandler.execute(InJoinActionHandler.java:52)
       at org.jbpm.graph.def.Action.execute(Action.java:123)
       at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235)
       at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212)
       at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182)
       at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166)
       at org.jbpm.graph.def.Node.enter(Node.java:301)
       at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
       at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$a65f5a67.enter(<generated>)

      Could someone pls. tell me what is going wrong. and how to correct it.
      Thanks in advance