3 Replies Latest reply on Jan 11, 2013 10:39 AM by zabalet

    WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime

    zabalet

      Hi people!

       

      I'm having this issue trying to upgrade process intances using WorkflowProcessInstanceUpgrader as described at http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e2318

       

      This is the line creating the knowledgeSession:

       

      ksession = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, env);
      

       

      and this is the line trying to upgrade:

       

      WorkflowProcessInstanceUpgrader.upgradeProcessInstance(knowledgeSession, processInstance.getId(), newProcessDefinitionId, mapping);
      

       

      Inside WorkflowProcessInstanceUpgrader there is the casting causing the problem

       

      processInstance.setKnowledgeRuntime((InternalKnowledgeRuntime) kruntime);
      

       

      The point is that CommandBasedStatefulKnowledgeSession does not implements InternalKnowledgeRuntime like his counterparts implementing StatefulKnowledgeSession.

       

         _StatefulKnowledgeSession

          |__CommandBasedStatefulKnowledgeSession (NOT implements InternalKnowledgeRuntime)

          |__StatefulKnowledgeSessionImpl (implements InternalKnowledgeRuntime)

          |__StatefulProcessSession (implements InternalKnowledgeRuntime)

         

       

      Then:

       

      - Should CommandBasedStatefulKnowledgeSession implement InternalKnowledgeRuntime like his counterparts?

       

      - Should I use a different implementation of StatefulKnowledgeSession?

       

      - There is a bigger issue around this inherent to the command based nature?

       

      (This same issue was somehow asked here (https://community.jboss.org/message/634907#634907) but there was no feedback)

       

      TIA.

       

      Marcelo.