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
Solved! Go to Solution.
Views
Replies
Total Likes
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!!
Hi @girishb83316758
You have to use subservice session not the getAdministrativeResourceResolver.
e.g. https://github.com/arunpatidar02/aem63app-repo/blob/master/java/SeesionInServletWithSubservice.java
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!!
@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!
Views
Replies
Total Likes
Just curious, why would you import Workflow instanced from an another system?
I hope you have the model and payloads on local as well
Imported data to replicate some issue in local instance.
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?
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!!
@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!
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies