3 Replies Latest reply on Feb 24, 2012 11:41 AM by zhujinwei

    Why is my kruntime null?

    Darryl Youngblood Newbie

      Hey guys,

       

      I tried to adapt this example webexample http://community.jboss.org/people/bpmn2user/blog/2011/09/21/jbpm5-web-example to my use case where I execute the follwoing lines:

       

      org.jbpm.workflow.instance.node.WorkItemNodeInstance currentNode = NodeFinder.findNodeInstance(MeyleTaskHandlerJPA.workItemdID, process);

       

      org.drools.definition.process.Node nextNode = currentNode.getNode().getOutgoingConnections().values().iterator().next().iterator().next().getTo();

       

      With help of the debugger I found out, that I get a NullPointer Exception when i call currentNode.getNode().

       

      getNode() from class NodeInstanceImpl returns:

       

      return ((org.jbpm.workflow.core.NodeContainer)

                  this.nodeInstanceContainer.getNodeContainer()).internalGetNode( this.nodeId );

       

      and here getNodeconteiner() from class WorkflowProcessInstanceImpl returns the return value of getWorkflowProcess() from same class which calls getProcess() from class ProcessInstanceImpl where the kruntime is null.

       

      if (this.process == null) {

                  this.process = kruntime.getKnowledgeBase().getProcess(processId);

              }

       

      My question is: why is the kruntime null?

       

      tyia

        • 1. Re: Why is my kruntime null?
          Ryan Peterson Newbie

          I'm running into this exact exception today trying to implement process migration via:  WorkflowProcessInstanceUpgrader.upgradeProcessInstance()

           

          During the migration, a call is made to getProcess() within ProcessInstanceImpl:

           

          public Process getProcess() {
              if (this.process == null) {
                  this.process = kruntime.getKnowledgeBase().getProcess(processId);
              }
              return this.process;
          }

           

          kruntime is null internally.

           

          Based on a different poster's experience I tried removing Bitronix as the transaction manager by commenting out the following:
          env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());

          I "think" it works, but I get an error further along in the conversion about being unable to cast CommandBasedStatefulKnowledgeSession to InternalKnowledgeRuntime.

           

          Not sure if this is helpful to you...

          • 2. Re: Why is my kruntime null?
            Darryl Youngblood Newbie

            yeah, that helped, thank you! Facing some new trouble though^^

            • 3. Re: Why is my kruntime null?
              zhujinwei Newbie

              This trouble has puzzled me , too . Hope someone can explain it!