Null pointer exception while invoking method while getting Asset from payload. | Community
Skip to main content
rajeshk94042740
Level 2
October 16, 2015
Solved

Null pointer exception while invoking method while getting Asset from payload.

  • October 16, 2015
  • 7 replies
  • 3551 views

Hi,

 

  I am trying to upgrade workflow from CQ 5.4 to 5.6.1 I am trying to invoke customized workflow which extends AbstractAssetWorkflowProcess.

     so trying to get asset in execute method but getting null pointer exception while fetching asset using getAssetFromPayload method.

 

 public void execute(WorkItem workItem, WorkflowSession wfSession, MetaDataMap metaData) throws WorkflowException {

    Session session = wfSession.getSession();

    final Asset asset = getAssetFromPayload(workItem, session);

    .....

    .....

}

 

Can any one please let me know I need to upgrade currently I am using cq-workflow-api version 5.6.2.

 

regards

Rajesh Karka

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

Make sure right version of api is used. You might need to change from [1] to [2].


[1]
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.exec.ParticipantStepChooser;
import com.day.cq.workflow.exec.WorkItem;
import com.day.cq.workflow.exec.WorkflowData;
import com.day.cq.workflow.metadata.MetaDataMap;

[2]
import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.ParticipantStepChooser;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.metadata.MetaDataMap;

7 replies

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Make sure right version of api is used. You might need to change from [1] to [2].


[1]
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.exec.ParticipantStepChooser;
import com.day.cq.workflow.exec.WorkItem;
import com.day.cq.workflow.exec.WorkflowData;
import com.day.cq.workflow.metadata.MetaDataMap;

[2]
import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.ParticipantStepChooser;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.metadata.MetaDataMap;

smacdonald2008
Level 10
October 16, 2015

Have you read this document that talks about upgrading - including workflows: http://dev.day.com/docs/en/cq/current/deploying/upgrading.html ? 

Please let us know. Thxs! 

October 16, 2015

Hey Sham,

I have one question here. As per your comment if we want to upgrade we need to re compile again our workflow code? 

rajeshk94042740
Level 2
October 16, 2015

Hi Sham,

 

   As per the documentation AbstractAssetWorkflowProcess is still using CQ workflow API and not included granite workflow API. All my workflows are using AbstractAssetWorkflowProcess which is causing Null pointer Exception while getting resource resolver inside Abstract asset workflow process. But there are lot of OOTB workflows are using this class and working fine.

 

Caused by: java.lang.NullPointerException
 at com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess.getResourceResolver(AbstractAssetWorkflowProcess.java:253)
 at com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess.getAssetFromPayload(AbstractAssetWorkflowProcess.java:90)
 at com.aptimus.common.workflow.FFMpegTranscodeProcess.execute(FFMpegTranscodeProcess.java:87)

 

regards

Rajesh Karka

Sham_HC
Level 10
October 16, 2015

Might need further investigation then. File a daycare ticket.

Sham_HC
Level 10
October 16, 2015

I would always recommend to see the api difference [1] & update your code base accordingly.

[1] 

http://dev.day.com/docs/en/cq/current/diff-previous/changes.html

http://dev.day.com/docs/en/cq/5-6/diff-previous/changes.html

andrew_leung
October 16, 2015

We are hitting the exact same problem here after upgrading from 5.5 to 6.0. Was there ever a Daycare ticket filed for this? If so, do we have a solution?

Thanks!