Expand my Community achievements bar.

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

8 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

Administrator

@girishb83316758 I hope you found the AEM community helpful. We look forward to seeing you return as either a learner or a contributor. The community flourishes with SMEs like you. Be an ambassober and ask your AEM peers to also contribute here. Happy AEM learning!



Kautuk Sahni

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!!

Avatar

Administrator

@girishb83316758 I trust you found the AEM community useful. We look forward to seeing you return as either a learner or a contributor. The community is enriched by SMEs like you. Encourage your AEM peers to contribute here as well. Happy AEM learning!



Kautuk Sahni