Expand my Community achievements bar.

Error(SightlyException) finding the resourcre -

Avatar

Level 3

Hello Community - I see some issues while accessing the pages in AEM eventhough the resource is available in the specifiied location. The component is pointing to the sling:resourceSuperType and the resource is already available in the resourceSuperType location. I have even copied the required resource directly under the component but it's still not working. Can you tell me what could be the issue?

 

Caused by: org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Required script resource could not be located: test.js. The caller is /apps/project/components/page/xfhead/content.html
	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.internal.extensions.ResourceExtension.call(ResourceExtension.java:138) [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.libs.cq.experience__002d__fragments.editor.components.experiencefragment.experiencefragment_html.render(experiencefragment_html.java:74)
	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]

 

3 Replies

Avatar

Community Advisor

Caused by: org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Required script resource could not be located: test.js. The caller is /apps/project/components/page/xfhead/content.html

 

Is there any reference to test.js file in content.html ?

The caller is /apps/project/components/page/xfhead/content.html

test.js file should be in same location or change the reference given in html file.

Avatar

Level 3

Thanks for your reply. The issue is with sling:resourceSuperType path. If I add the /libs/path-of-the-component, it is working as expected but we don't need to specify /apps/ or /libs/. Do I need to specify in any of the configs to look for /apps/ first followed by /libs/ for the resolution. As far as I know, we don't need to specify the hierarchy. Please let me know. Thank you! 

Avatar

Level 8

@test1234567 : There is an issue with the way you are trying to access your javascript use api. Please refer this article to get some info: https://medium.com/@toimrank/aem-javascript-use-api-925fb2a270b

If possible, please share your htl snapshot and also the structure where your are placing your test.js, that will help to identify the exact issue.

Also, you can think about moving the logic/operation from your test.js to your sling model.

thanks.