Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

InvocationTargetException

Avatar

Level 6

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

Avatar

Correct answer by
Community Advisor

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.htm... 



Esteban Bustamante

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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.htm... 



Esteban Bustamante