InvocationTargetException | Adobe Higher Education
Skip to main content
Keerthi0555
Level 5
August 9, 2023
Beantwortet

InvocationTargetException

  • August 9, 2023
  • 1 Antwort
  • 600 Ansichten

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.
Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von EstebanBustamante

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 

1 Antwort

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 9, 2023

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