Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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;

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

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;

Avatar

Level 10

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! 

Avatar

Former Community Member

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? 

Avatar

Level 2

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

Avatar

Level 10

Might need further investigation then. File a daycare ticket.

Avatar

Level 1

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!