5 Replies Latest reply on Oct 21, 2008 11:57 AM by Ronald van Kuijk

    classcast exception getting tasknode

    Sascha Janz Master

      i've written my own command to create tasks at runtime.

      but when i try to get the tasknode i got an class cast exception

      2008-10-20 17:26:23,496 INFO [STDOUT] node name:in Bearbeitung
      2008-10-20 17:26:23,496 INFO [STDOUT] node class:class org.jbpm.graph.def.Node_$$_javassist_80
      2008-10-20 17:26:23,496 ERROR [STDERR] java.lang.ClassCastException: org.jbpm.graph.def.Node_$$_javassist_80 cannot be cast to org.jbpm.graph.node.TaskNode

      although it is really a tasknode...

      what am i doing wrong?

      here is the code


      ProcessInstance pi = jbpmContext.getProcessInstance(processid);
      
       if (cat.isDebugEnabled()) {
       cat.debug("add task command");
       cat.debug("token:"+ pi.getRootToken().getId());
       cat.debug("node name:"+ pi.getRootToken().getNode().getName());
       cat.debug("node class:"+ pi.getRootToken().getNode().getClass());
       }
       TaskNode tn = (TaskNode) pi.getRootToken().getNode();
       Task t= tn.getTask("mytask");