Exception while trying to run a custom workflow | Community
Skip to main content
Employee
May 18, 2023
Solved

Exception while trying to run a custom workflow

  • May 18, 2023
  • 3 replies
  • 1702 views

Hi 

While trying to run a custom workflow AEM 6.5 sp13 I am getting 

 

java.lang.NullPointerException: null
at java.base/java.util.Hashtable.put(Hashtable.java:475)
at com.adobe.granite.workflow.core.event.EventPublishUtil.publishWorkflowStartedEvent(EventPublishUtil.java:159) [com.adobe.granite.workflow.core:2.0.240.CQ656-B0017]
at com.adobe.granite.workflow.core.WorkflowSessionImpl.startWorkflow(WorkflowSessionImpl.java:2000) [com.adobe.granite.workflow.core:2.0.240.CQ656-B0017]
at com.day.cq.workflow.impl.CQWorkflowSessionWrapper.startWorkflow(CQWorkflowSessionWrapper.java:297) [com.day.cq.workflow.cq-workflow-impl:6.3.8.CQ652-B0003]
at com.day.cq.workflow.impl.CQWorkflowSessionWrapper.startWorkflow(CQWorkflowSessionWrapper.java:249) [com.day.cq.workflow.cq-workflow-impl:6.3.8.CQ652-B0003]
 
What does this exception point to ?
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 MayurSatav

As i already mentioned, Check your Hashtable.java:475, the error occurs at line 475 in the Hashtable class, specifically in the put() method. It seems that a null value is being passed to the put() method, causing the exception. Debugging the code and inspecting the relevant variables at runtime may help pinpoint the root cause of the issue.

3 replies

EstebanBustamante
New Participant
May 18, 2023

You are not reading correctly the log, the exception is thrown in java.util.Hashtable.put(Hashtable.java:475) but there is a stack behind that, if you read the log downwards you will find which class/action is initiating the action that ultimately will cause a NULLPOINTER in granite code. 

 

With the couple of lines you have provided it is not possible to see what is the real issue initiator if that makes sense.

I recommend checking how to read logs here: https://stackoverflow.com/questions/12688068/how-to-read-and-understand-the-java-stack-trace

Esteban Bustamante
tasunil1Author
Employee
May 18, 2023

Hi @estebanbustamante ,

I tried as much I could do

instance.getworkflowmodel().gettitle() is null even when the title is there in the model

 

Ritesh_Mittal
New Participant
May 18, 2023

Hi @tasunil1 ,

 

Start the debugger in your local, put debugger point at line number 159 in EventPublishUtil.java. There should be some object which is null and some operation is being performed on the same object.

 

Also, please use Optional wherever applicable instead of handling NullPointerException.

 

Thanks,

Ritesh Mittal

tasunil1Author
Employee
May 18, 2023

Hi @mayursatav & @ritesh_mittal 

This means i would need to debug granite code. Thanks 

MayurSatav
New Participant
May 18, 2023

Hi @tasunil1 ,

 

The exception java.lang.NullPointerException indicates that a null value was encountered where it was not expected. In this specific case, the exception is being thrown at the line java.util.Hashtable.put(Hashtable.java:475), which suggests that there is an issue with adding a value to a Hashtable. Also the stack trace shows that the exception is being triggered within the com.adobe.granite.workflow.core.event.EventPublishUtil.publishWorkflowStartedEvent method, which is responsible for publishing events related to workflow start.

tasunil1Author
Employee
May 18, 2023

Hello @mayursatav ,

 

The null pointer was understandable that it is failing to put data related to workflow start, but to clear out more what exactly is it failing at, what detail to pin point ? 

MayurSatav
MayurSatavAccepted solution
New Participant
May 18, 2023

As i already mentioned, Check your Hashtable.java:475, the error occurs at line 475 in the Hashtable class, specifically in the put() method. It seems that a null value is being passed to the put() method, causing the exception. Debugging the code and inspecting the relevant variables at runtime may help pinpoint the root cause of the issue.