InvocationTargetException | Community
Skip to main content
Keerthi0555
Level 5
Aug 9, 2023 11:20 AM UTC
Solved

InvocationTargetException

I'm getting target invocation exception at this line of my code

 

 Tag tag = resource.adaptTo(Tag.class);
The resource is not adapting to Tag tag is returning null.
 resource is not returning null, but getting target invocation exception.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
Aug 9, 2023 1:10 PM UTC

Mainly 2 things to check:

1) Is the "Tag" imported from com.day.cq.tagging.Tag?

2) If the resource is a cq:Tag node resource

 

Reference:
https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/sling-adapters.html?lang=en#null-return-value 

Esteban Bustamante

1 reply

EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
Aug 9, 2023 1:10 PM UTC

Mainly 2 things to check:

1) Is the "Tag" imported from com.day.cq.tagging.Tag?

2) If the resource is a cq:Tag node resource

 

Reference:
https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/sling-adapters.html?lang=en#null-return-value 

Translate
Esteban Bustamante