Error: org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method redirectTarget | Community
Skip to main content
Level 5
May 16, 2023

Error: org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method redirectTarget

  • May 16, 2023
  • 3 replies
  • 3148 views

Hi All,

 

I see a lot of error messages from the error log

 

org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method redirectTarget on object com.adobe.cq.wcm.core.components.internal.models.v1.PageImpl@76ab2dd2

 

com.adobe.cq.wcm.core.components.models.Page.getAppResourcesPath(Page.java:286) [com.adobe.cq.core.wcm.components.core:2.7.0]

 

org.apache.sling.scripting.sightly.render.ObjectModel Cannot access method appResourcesPath on object com.adobe.cq.wcm.core.components.internal.models.v1.PageImpl@76ab2dd2

...

 

This is the snippet of code from core/wcm/components/page/v2/page/page.html:

<sly data-sly-test.isRedirectPage="${page.redirectTarget && (wcmmode.edit || wcmmode.preview)}"

             data-sly-call="${redirect.redirect @ redirectTarget = page.redirectTarget}"></sly>

 

I am using core/wcm/components/page/v2/page as the foundation page resource for all pages. the sling:superResourceType of page/v2/page is wcm/foundation/components/basicpage/v1/basicpage. I see a similar bug report on the page, https://github.com/adobe/aem-core-wcm-components/issues/772. How can I eliminate those errors?

 

Thanks!

 

-kt

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

rawvarun
Community Advisor
Community Advisor
May 16, 2023

Which AEM version are you using?

Kevin_GTaAuthor
Level 5
May 16, 2023

It's AEM 6.5, archetype 22.

MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 17, 2023

Hi @kevin_gta ,

The error messages indicate that there is an issue with accessing the redirectTarget property in the Page model of the AEM Core Components. This issue is similar to the bug report you mentioned (https://github.com/adobe/aem-core-wcm-components/issues/772). To eliminate these errors, you can try the following steps:

 

  1. Verify AEM Core Components Version: Ensure that you are using a version of AEM Core Components that includes the fix for the reported bug. Upgrade to a newer version if necessary.

  2. Check Page Component Configuration: Confirm that the Page component (core/wcm/components/page/v2/page) is configured correctly. Ensure that the sling:resourceSuperType of the component is set to wcm/foundation/components/basicpage/v1/basicpage.

  3. Clear AEM Component Cache: Clear the AEM component cache to ensure that the latest changes to the component are reflected. You can do this by navigating to the AEM Web Console (http://localhost:4502/system/console/components) and clicking on "Clear" under the "Cache" tab.

Kevin_GTaAuthor
Level 5
May 30, 2023

Hi @mayursatav ,

 

Yes, it's the issue of not being able to access the redirectTarget property and many other objects' property. This is one of those. 

1. I got that out of Box, I don't know where to check the version

2. It's configured correctly, by tracing down from /crx/de.

3. I restarted the instance many times, still the same. I don't see Cache tab from the /system/console/components.

 

Thanks!

 

-kt

 

 

Kevin_GTaAuthor
Level 5
May 31, 2023

It looks all about the directory permission issue, but I don't know where the breaking point is. The AEM OOTB super resource is "

core/wcm/components/page/v2/page", which is under /apps. I like to have my own so I cloned one as "/apps/mysite/wcm/components/page/v2/page", whereby I can customize it, such as adding a lot of definitions on top of the original one. The problem comes from the sling:superResourceType. Its value is "

wcm/foundation/components/basicpage/v1/basicpage"; it's under "/libs/wcm/foundation/components/basicpage/v1/basicpage". I believe there is a permission restriction between the cloned page component and the "/libs/wcm". Now I set the sling:superResourceType of the cloned page to "core/wcm/components/page/v2/page", instead of "wcm/foundation/components/basicpage/v1/basicpage". The error messages disappear.

 

-kt

joerghoh
Adobe Employee
Adobe Employee
June 16, 2023

This has nothing to do with your content.

When you check the v1 PageImpl class, you can see that this model does not have any getRedirectTarget or getAppResourcesPath method.

 

 

 

Kevin_GTaAuthor
Level 5
June 16, 2023

I copied everything from core/wcm/components/page to /apps/mysite/wcm/components/page, it doesn't work. I was expecting it will work since I didn't change anything. Then I cloned core/wcm/components/page/v2 to core/wcm/components/page/v3, and the page resource sling:resourceSuperType is core/wcm/components/page/v3/page, it doesn't work, either. But it works if I refer it to core/wcm/components/page/v2/page. I don't get it.