How to resolve "java.lang.reflect.InvocationTargetException: null" error while adding component in the page

Avatar

Avatar
Level 1
sushmitha-srinivasan
Level 1

Likes

0 likes

Total Posts

26 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
sushmitha-srinivasan
Level 1

Likes

0 likes

Total Posts

26 posts

Correct reply

0 solutions
View profile
sushmitha-srinivasan
Level 1

11-06-2020

Hi

 

I'm getting below error in the error.log when using the core components in my content pages. 

 

The reason why I checked on the logs is dialog values are not getting fetched/displayed in the page and hence i checked the error logs and found below errors for Button and list component. 

 

11.06.2020 11:59:41.328 ERROR [0:0:0:0:0:0:0:1 [1591856981100] GET /content/sample/us/sample_home1.html HTTP/1.1] org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method listItems on object com.adobe.cq.wcm.core.components.internal.models.v1.ListImpl@5b6e36a9 java.lang.reflect.InvocationTargetException: null

 

10.06.2020 20:01:17.889 ERROR [0:0:0:0:0:0:0:1 [1591799476187] GET /content/orora/us/orora_home.html HTTP/1.1] org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method text on object com.adobe.cq.commerce.core.components.internal.models.v1.button.ButtonImpl@389ca05d java.lang.reflect.InvocationTargetException: null

 

Kindly please let me know what causing this error and how to resolve it. OOB Button and List components from core folders are not working properly.

 

I'm working in AEM 6.5.0 and my Core components are 2.7.0

sushmitha-srinivasan

I'm working in AEM 6.5.0 and my Core components are 2.7.0

sushmitha-srinivasan

Hi Arun_Patidar... I have extended the Button component by using one of the classes from Teaser component and also i have added actionsEnabled property to add checkbox condition to my button. My actual Core Button Component and List Component codes are as follows

 

<button data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button"
data-sly-use.iconTemplate="icon.html"
data-sly-element="${button.link ? 'a' : 'button'}"
class="cmp-button"
href="${button.link}"
aria-label="${button.accessibilityLabel}">
<sly data-sly-call="${iconTemplate.icon @ icon=button.icon}"></sly>
<span data-sly-test="${button.text}" class="cmp-button__text">${button.text}</span>
</button>

 

<ul data-sly-use.list="com.adobe.cq.wcm.core.components.models.List"
data-sly-list.item="${list.listItems}"
data-sly-use.template="core/wcm/components/commons/v1/templates.html"
data-sly-use.itemTemplate="item.html"
class="cmp-list">
<li class="cmp-list__item" data-sly-call="${itemTemplate.item @ list = list, item = item}"></li>
</ul>
<sly data-sly-call="${template.placeholder @ isEmpty=list.listItems.size == 0, classAppend='cmp-list'}"></sly>

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
Employee
surabhikatiyar
Employee

Likes

68 likes

Total Posts

46 posts

Correct reply

18 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Employee
surabhikatiyar
Employee

Likes

68 likes

Total Posts

46 posts

Correct reply

18 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
surabhikatiyar
Employee

11-06-2020

Can you confirm in which AEM version and which core component version are you facing this issue?

 

According to the historical versions, Core Components 2.3.0 and Core Components Extension 1.0.10 have 6.4.2.0 as their minimum requirement. The recommendation would, therefore, be to upgrade to the correct version.

 

Here is the list of Core Components Package compatibility

https://docs.adobe.com/content/help/en/experience-manager-core-components/using/versions.html

Answers (2)

Answers (2)

Avatar

Avatar
Boost 5
Level 3
manising
Level 3

Likes

20 likes

Total Posts

19 posts

Correct reply

7 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile

Avatar
Boost 5
Level 3
manising
Level 3

Likes

20 likes

Total Posts

19 posts

Correct reply

7 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile
manising
Level 3

11-06-2020

The model at https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq... does not export a method like getListItems , It has  getItems() . So you can call it like shown below

 

data-sly-use.list="com.adobe.cq.wcm.core.components.models.List"

data-sly-list.item="${list.items}"

 

For com.adobe.cq.commerce.core.components.internal.models.v1.button.ButtonImpl,. I see it implemented in CIF framework https://github.com/adobe/aem-core-cif-components/blob/master/bundles/core/src/main/java/com/adobe/cq.... Did you install this framework?

 

 

 

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

11-06-2020

Can you share HTL code (data-sly-use part )which you are using to in custom component?