Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

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

Avatar

Level 7

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

8 Replies

Avatar

Community Advisor

Which AEM version are you using?

Avatar

Community Advisor

Hi @kevingtan ,

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.

Avatar

Level 7

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

 

 

Avatar

Level 7

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

Avatar

Level 7

Hi @MayurSatav 

 

I started another thread at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/error-org-apache-sling-scr... for the continuing discussion of this topic, if you are interested. Thanks for all your help!

Avatar

Employee Advisor

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.

 

 

 

Avatar

Level 7

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.