Skip to Content
avatar image
Former Member

Getting NullPointerException in Workflow

Hi Expert,

We have having a requirement to create a 3-Step workflow for Contract Document.

I have followed the standard workflow document and created the xpdl file.

We are facing an issue that Contract Document is still locked when all the approver approved the Contract Document and phase of the document is also not moved to next phase.

Please find the code which we have written in Postscript:

String PREV_PHASE_ON_DENIED = "Draft";

   

// The final step of the approval process moves the phase of the Approved document

// Create a logger for messaging

logMsg = Logger.createLogMessage(session);

logMsg.setLogMessage("CONTRACT WORKFLOW:CURRENT PHASE - "+ doc.getCurrentPhase());

Logger.info(logMsg);

// If we are not approved, then change the phase backward

if(getApprovalStatus() != APPROVED)

{

  home = doc.getIBeanHomeIfc();

  home.upgradeToEdit(doc);

  try

  {

 

  phaseList=home.findValidPreviousPhasesExternalIds(doc);

  phaseListIterator=phaseList.iterator();

  while(phaseListIterator.hasNext())

  {

   logMsg.setLogMessage("Previous  Phase "+phaseListIterator.next());

   Logger.info(logMsg);

  }

  home.changePhase(doc,PREV_PHASE_ON_DENIED);

  }

  catch(e)

  {

   logMsg.setLogMessage(e.toString());

   logMsg.setException(e);

   Logger.error(logMsg);

  }  }

 

// If we are approved, then change the phase forward

     if (getApprovalStatus() == APPROVED)

   {    home = doc.getIBeanHomeIfc();

    nextPhase = home.findValidNextPhasesExternalIds(doc).get(0);

    logMsg.setLogMessage("Phase Change Started"+ nextPhase);

    Logger.info(logMsg);

    home.upgradeToEdit(doc);

    try

    {

        home.changePhase(doc,nextPhase);

    }

    catch(e)

    {

        logMsg.setException(e);

        Logger.error(logMsg);

    }

    home.downgradeToView(doc);

}

logMsg.setLogMessage("*************End Of Approval ***********"+new Date());

Logger.info(logMsg);

In the NWA log, we are getting below error message:

Facility=local4;sessionid=9235e9ac102b6d24e9473447baa592884c19881;tenantid=#system#;username=guest;exception=java.lang.NullPointerException: while trying to invoke the method com.sap.odp.common.db.PersistentBo.getObjectReference() of an object loaded from local variable 'cluster';stacktrace=java.lang.NullPointerException: while trying to invoke the method com.sap.odp.common.db.PersistentBo.getObjectReference() of an object loaded from local variable 'cluster'.

Please suggest how to resolve this issue.

Any help will be really appreciated.

Regards,

Ravi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 07, 2013 at 08:16 PM

    Hi Ravi,

    Can you try removing the new Date() on the last but one line in logMsg? Also, could you tell what the imports are in the postscript?

    -

    Bindu

    Add comment
    10|10000 characters needed characters exceeded