Expand my Community achievements bar.

SOLVED

data-sly-resource issue in AEM 6.5

Avatar

Level 3

Hi Team, 

We are migrating from AEM 6.4 to AEM 6.5 and Java 11. All the necessary stuffs like uber jar and other dependencies were changed . The bundle is active and everything is good. We are including the header and footer as below

<sly data-sly-resource="${page.syndicatedLoadPath @ selectors='header.syn'}" data-sly-unwrap data-sly-test="${page.syndicatedInclude}"></sly>

This works fine in AEM 6.4 . However in 6.5, we are getting the below error. 

Caused by: org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.api.scripting.ScriptEvaluationException:
at com.adobe.cq.sightly.WCMScriptHelper.includeResource(WCMScriptHelper.java:184) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
at com.adobe.cq.sightly.WCMScriptHelper.includeResource(WCMScriptHelper.java:134) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
at com.adobe.cq.sightly.internal.extensions.ResourceExtension.call(ResourceExtension.java:149) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:77) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
at org.apache.sling.scripting.sightly.apps.svt.components.structure.foundation.partials.body_html$1.render(body_html.java:175)
at org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:50) [org.apache.sling.scripting.sightly.runtime:1.1.0.1_4_0]
at org.apache.sling.scripting.sightly.render.RenderUnit.callUnit(RenderUnit.java:87) [org.apache.sling.scripting.sightly.runtime:1.1.0.1_4_0]
at org.apache.sling.scripting.sightly.apps.svt.components.structure.foundation.foundation_html.render(foundation_html.java:129)
at org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:50) [org.apache.sling.scripting.sightly.runtime:1.1.0.1_4_0]
at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:60) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.3.2]
... 198 common frames omitted
Caused by: org.apache.sling.api.scripting.ScriptEvaluationException:
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:570) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:82) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:159) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:278) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.page.PageLockFilter.doFilter(PageLockFilter.java:91) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:94) [com.day.cq.cq-personalization:5.12.44]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217) [com.adobe.granite.csrf:1.0.20.CQ650-B0002]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:283) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:323) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:516) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at com.adobe.cq.sightly.WCMScriptHelper.includeResource(WCMScriptHelper.java:179) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
... 210 common frames omitted
Caused by: org.apache.sling.api.SlingException:
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:533) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:339) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:97) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:600) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) [org.apache.sling.scripting.core:2.3.2]
... 234 common frames omitted
Caused by: org.apache.sling.api.SlingException:
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:533) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:339) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:97) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:600) [org.apache.sling.scripting.jsp:2.3.6]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:570) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:82) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:159) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:278) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.page.PageLockFilter.doFilter(PageLockFilter.java:91) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:94) [com.day.cq.cq-personalization:5.12.44]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217) [com.adobe.granite.csrf:1.0.20.CQ650-B0002]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:283) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:323) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211) [org.apache.sling.engine:2.7.4]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104) [org.apache.sling.engine:2.7.4]
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:516) [com.day.cq.wcm.cq-wcm-core:5.12.172]
at com.day.cq.wcm.tags.IncludeTag.includeResource(IncludeTag.java:254) [com.day.cq.wcm.cq-wcm-taglib:5.13.8]
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:103) [com.day.cq.wcm.cq-wcm-taglib:5.13.8]
at org.apache.jsp.libs.foundation.components.iparsys.iparsys_jsp._jspService(iparsys_jsp.java:405)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) [org.apache.sling.scripting.jsp:2.3.6]
... 239 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -4
at java.base/java.lang.String.substring(String.java:1841)
at org.apache.jsp.libs.foundation.components.iparsys.par.par_jsp._jspService(par_jsp.java:232)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) [org.apache.sling.scripting.jsp:2.3.6]
... 273 common frames omitted

 

Request your assistance on this. Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 3

The issue has been resolved. 

<sly data-sly-resource="${page.syndicatedLoadPath @ selectors='header.syn'}" data-sly-unwrap data-sly-test="${page.syndicatedInclude}"></sly>

 

Here the page.syndicatedLoadPath contains a '.html' which was causing the issue. We had removed this and tested , all looks fine.

However the same path with .html extension works in 6.4 , not in 6.5 . Interesting ! Any thoughts ?

View solution in original post

4 Replies

Avatar

Community Advisor

Can you verify all the tags are available on the new AEM version.

Avatar

Community Advisor

Hey @sivas61374651 

You should check the bundle first and make sure that all the required dependencies are getting resolved. 

You may get some hint from 6.5 release notes about new dependencies (uber.jar, core component etc), you should look into that. 

See below thread, 

 

Solved: org.apache.sling.scripting.sightly.SightlyExceptio... - Adobe Experience League Community - ...

 

Avatar

Level 6

As far as I have seen, it does work fine now as well. Check out the syntax here:

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/block-statements.html?lang=...

resource

data-sly-resource includes the result of rendering the indicated resource through the sling resolution and rendering process.

A simple resource include:

<article data-sly-resource="path/to/resource"></article>
Copy

Path Not Always Required

Note that use of a path with data-sly-resource is not required if you already have the resource. If you already have the resource, you can use it directly.

For example the following is correct.

<sly data-sly-resource="${resource.path @ decorationTagName='div'}"></sly>
Copy

However the following is also perfectly acceptable.

<sly data-sly-resource="${resource @ decorationTagName='div'}"></sly>
Copy

It is recommended to use the resource directly when possible due to the following reasons.

  • If you already have the resource, re-resolving using the path is additional, unnecessary work.
  • Using the path when you already have the resource can introduce unexpected results since Sling resources can be wrapped or can be synthetic and not provided at the given path.

Options

Options allow a number of additional variants:

Manipulating the path of the resource:

<article data-sly-resource="${ @ path='path/to/resource'}"></article>
<article data-sly-resource="${'resource' @ prependPath='my/path'}"></article>
<article data-sly-resource="${'my/path' @ appendPath='resource'}"></article>
Copy

Add (or replace) a selector:

<article data-sly-resource="${'path/to/resource' @ selectors='selector'}"></article>
Copy

Add, replace or remove multiple selectors:

<article data-sly-resource="${'path/to/resource' @ selectors=['s1', 's2']}"></article>
Copy

Add a selector to the existing ones:

<article data-sly-resource="${'path/to/resource' @ addSelectors='selector'}"></article>
Copy

Remove some selectors from the existing ones:

<article data-sly-resource="${'path/to/resource' @ removeSelectors='selector1'}"></article>
Copy

Remove all selectors:

<article data-sly-resource="${'path/to/resource' @ removeSelectors}"></article>
Copy

Overrides the resource type of the resource:

<article data-sly-resource="${'path/to/resource' @ resourceType='my/resource/type'}"></article>
Copy

Changes the WCM mode:

<article data-sly-resource="${'path/to/resource' @ wcmmode='disabled'}"></article>
Copy

By default, the AEM decoration tags are disabled, the decorationTagName option allows to bring them back, and the cssClassName to add classes to that element.

<article data-sly-resource="${'path/to/resource' @ decorationTagName='span',
cssClassName='className'}"></article>
Copy
NOTE

AEM offers clear and simple logic controlling the decoration tags that wrap included elements. For details see Decoration Tag in the developing components documentation. 

Avatar

Correct answer by
Level 3

The issue has been resolved. 

<sly data-sly-resource="${page.syndicatedLoadPath @ selectors='header.syn'}" data-sly-unwrap data-sly-test="${page.syndicatedInclude}"></sly>

 

Here the page.syndicatedLoadPath contains a '.html' which was causing the issue. We had removed this and tested , all looks fine.

However the same path with .html extension works in 6.4 , not in 6.5 . Interesting ! Any thoughts ?