Expand my Community achievements bar.

SOLVED

Exception while trying to run a custom workflow

Avatar

Employee

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 ?
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

7 Replies

Avatar

Community Advisor

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.

Avatar

Employee

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 ? 

Avatar

Correct answer by
Community Advisor

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.

Avatar

Community Advisor

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

Avatar

Community Advisor

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

Avatar

Employee

Hi @EstebanBustamante ,

I tried as much I could do

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

IMG_3421.jpeg

IMG_3422.jpeg