Hi,
I am using AEM 6.5.19 and created a simple sling servlet adapting to Resource. However when I use the sling model in html, getting the following error:
org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: No use provider could resolve identifier com.kishore.project.core.models.kishoremodel
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:510) [org.apache.sling.scripting.core:2.3.2]
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:579) [org.apache.sling.engine:2.7.10.B0006]
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [org.apache.sling.engine:2.7.10.B0006]
When i check inn status-sling models, not finding my sling model.
Question: Do i need to include anything in the POM.xml to support sling models? Please note my project was generated using Maven archetype 39.
Any help is highly appriciated.
Regards,
Kishore
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @kishored6899358 ,
Sling model should be in TitleCase, change it to Kishoremodel in java and sightly both.
Thanks
Hi Kishore,
It could be one of the two reasons mentioned below:
Sling-Model-Packages may have incorrect package path. Check the bnd-maven-plugin configuration in pom.xml
I came across this answer https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/what-s-the-advantage-of-us... in the community which has great details on different approaches of sling model exporters.
Thanks,
Lokesh
Thank you for your reply
The package-info.json is available under models
@Version("1.0")
package com.kishore.project.core.models;
import org.osgi.annotation.versioning.Version;
And using ModelsScannerPlugin for sling model registration.
Regards,
Kishore
Hi @kishored6899358 ,
You may check typo in model call-
<sly data-sly-use.model="com.kishore.project.core.models.kishoremodel" />
try K of Kishoremodel in camelcae as most probably your sling model would be in TitleCase
Cross check if package-info.java file present
Check the import statements
Thanks
The model is in lowercase only and the package-info.json is available under the models.
Regards,
Kishore
Hi @kishored6899358 ,
Sling model should be in TitleCase, change it to Kishoremodel in java and sightly both.
Thanks
It works. Thank you @MukeshYadav_