1 Reply Latest reply on Jun 19, 2008 5:28 AM by Laurent JOLIN

    Process variable class cast exception after signal()

    Joerg Glandorf Newbie

      I have a process running fine until it reaches wait-state.
      Each action node gets and sets some process variable without any problem.
      The next action node (after the wait-state) throws class cast exception when attempting to get the same process variable (which was no problem in the nodes before the wait-state)
      Is there any problem known in this area ?
      I use a lot JMS i.e. the signal is send from some JMS thread via calling some SLSB.
      I use jbpm 3.1.2


      Here is some output of the logging when everything works fine:
      (2 process instances retrieving 'control' variable)

      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] contextInstanceId=0
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] contextInstanceId=0
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving control variable : control processInstanceId=62
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving control variable : control processInstanceId=63
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] class of context var=class .....common.jbpm.ProcessVariableProteinIDControl
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] class of context var=class .....common.jbpm.ProcessVariableProteinIDControl
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving context variable : context processInstanceId=62
      2007-01-29 18:10:25,625 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving context variable : context processInstanceId=63


      After sending the signal the same steps (getting the variable) gives the following:

      the class returned from context.getContextInstance().getVariable has changed and obviously cannot be cast to the type expected (which was working before).
      Also getContextInstance().getId() now has a value > 0 for some reason...


      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'before-signal' on 'State(waitforSlot)' for 'Token(/)'
      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'before-signal' on 'State(waitforSlot)' for 'Token(/)'
      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'node-leave' on 'State(waitforSlot)' for 'Token(/)'
      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'node-leave' on 'State(waitforSlot)' for 'Token(/)'
      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'transition' on 'Transition()' for 'Token(/)'
      2007-01-29 18:10:25,969 DEBUG [org.jbpm.graph.def.GraphElement] event 'transition' on 'Transition()' for 'Token(/)'
      2007-01-29 18:10:25,984 DEBUG [org.jbpm.graph.def.GraphElement] event 'node-enter' on 'Node(pullResult)' for 'Token(/)'
      2007-01-29 18:10:25,984 DEBUG [org.jbpm.graph.def.GraphElement] event 'node-enter' on 'Node(pullResult)' for 'Token(/)'
      2007-01-29 18:10:25,984 DEBUG [.....jbpm.handler.PullResultActionHandler] pullResultActionHandler starting...
      2007-01-29 18:10:25,984 DEBUG [.....jbpm.handler.PullResultActionHandler] pullResultActionHandler starting...
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] contextInstanceId=114
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] contextInstanceId=115
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving control variable : control processInstanceId=63
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] retrieving control variable : control processInstanceId=62
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] class of context var=class org.jbpm.bytes.ByteArray$$EnhancerByCGLIB$$c35f0bd6
      2007-01-29 18:10:26,000 DEBUG [.....jbpm.handler.ActionHandlerTemplate] class of context var=class org.jbpm.bytes.ByteArray$$EnhancerByCGLIB$$c35f0bd6
      2007-01-29 18:10:26,000 ERROR [.....jbpm.handler.ActionHandlerTemplate] Got Exception executing node action. processInstanceId=62
      java.lang.ClassCastException: org.jbpm.bytes.ByteArray$$EnhancerByCGLIB$$c35f0bd6 cannot be cast to .....common.jbpm.ProcessVariableProteinIDControl
      at .....jbpm.handler.ActionHandlerTemplate.execute(ActionHandlerTemplate.java:45)
      at .....jbpm.handler.PullResultActionHandler.execute(PullResultActionHandler.java:35)
      at org.jbpm.graph.def.Action.execute(Action.java:123)
      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.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
      at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$226d945.execute(<generated>)
      at org.jbpm.graph.def.Node.execute(Node.java:328)
      at org.jbpm.graph.def.Node.enter(Node.java:316)
      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.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
      at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$864c9e11.enter(<generated>)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:383)
      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.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
      at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$864c9e11.leave(<generated>)
      at org.jbpm.graph.exe.Token.signal(Token.java:174)
      at org.jbpm.graph.exe.Token.signal(Token.java:123)
      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.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
      at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$32db44a5.signal(<generated>)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217)
      at .....services.control.WorkflowServiceImpl$JbpmSignaler.doInJbpm(WorkflowServiceImpl.java:155)
      at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:86)
      at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
      at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
      at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:79)
      at .....services.control.WorkflowServiceImpl.handleSendSignal(WorkflowServiceImpl.java:217)
      at .....services.control.WorkflowServiceBase.sendSignal(WorkflowServiceBase.java:53)
      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)

      ...
      ...
      ...