Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Workflow service.getworkflow throws null pointer exception

Avatar

Level 4

Hello Team

 

 

Related to workflow access facing some issue.

I have imported workflow nodes (var folder nodes) from higher environment to my local.

 

In my local im trying to access these workflow in servlet but I keep getting null pointer exception.

 

/Var folder server0 and server1 folder. Since I installed them using package manager. It shows created by admin.

 

Servlet code

 

ResourceResolver resResolver = resolverFactory.getAdministrativeResourceResolver(null);

session=resourceResolver.adaptTo(session.class);

WorkflowSession wfsession = workflowServixe.getworkflowsession(session);

Workflow workflow= wfsession.getworkflow("<workflow path>")

 

This code throws null pointer exception. Why is it??

Any issues with importer content? Or permissions?

 

 

Any inputs would help. Thank you

 

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 4

I do have related models in my local instance.

However, the workflow model version number were different.

Imported workflow nodes had model version which were not present in my instance. Hence during getWorkflow - version error was occurring.

 

Then I checked the versions of workflows models in my local and updated to the imported content to match it. Then it worked.

 

Thanks!!

View solution in original post

6 Replies

Avatar

Level 4

I did try this approach as well. But same results.

Turns out the workflow model version no. in my local and other instance were different. Keeping version number in sync worked.

Thank you!!

Avatar

Community Advisor

@girishb83316758 

 

Just curious, why would you import Workflow instanced from an another system?

I hope you have the model and payloads on local as well

 


Aanchal Sikka

Avatar

Level 3

Hi @girishb83316758  Beside the var folder you also need the nodes related to that workflow under /conf/global/settings/workflow/models/YOURWORKFLOW

Can you confirm do you have  models nodes also in your workflow package?

Avatar

Correct answer by
Level 4

I do have related models in my local instance.

However, the workflow model version number were different.

Imported workflow nodes had model version which were not present in my instance. Hence during getWorkflow - version error was occurring.

 

Then I checked the versions of workflows models in my local and updated to the imported content to match it. Then it worked.

 

Thanks!!