1 Reply Latest reply on Nov 19, 2012 4:25 PM by tmag

    WorkflowProcessInstanceUpgrader - How to

    tmag Newbie

      Anyone have a working example on WorkflowProcessInstanceUpgrader ?

       

      As per jBPM 5.3 documentation - when we tried upgradeProcessInstance()  -


      •      without a user transaction - its giving NullPointerException

       

      Exception in thread "main" java.lang.NullPointerException

          at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)

          at org.jbpm.workflow.instance.WorkflowProcessInstanceUpgrader.upgradeProcessInstance(WorkflowProcessInstanceUpgrader.java:57)

       

      •      Within a user transaction - its giving ClassCastException

      java.lang.ClassCastException: org.drools.command.impl.CommandBasedStatefulKnowledgeSession cannot be cast to org.drools.common.InternalKnowledgeRuntime

          at org.jbpm.workflow.instance.WorkflowProcessInstanceUpgrader.upgradeProcessInstance(WorkflowProcessInstanceUpgrader.java:61)

        • 1. Re: Any WorkflowProcessInstanceUpgrader working example
          tmag Newbie

          GenericCommand worked :

           

           

          ....................

          final ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.v1", null);

          ................

          GenericCommand<Void> genericCommand = new GenericCommand<Void>() {

                             

                              public Void execute(Context context) {

                                  StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();

                                  ProcessInstance processInstance = ksession.getProcessInstance(processInstance.getId());

                                  WorkflowProcessInstanceUpgrader.upgradeProcessInstance(ksession, processInstance.getId(), "com.sample.bpmn.v2", mapping);

                                  return null;

                              }

                          };