Getting error msg 'No use provider could resolve identifier' when using sling model in HTL | Community
Skip to main content
New Participant
January 4, 2017
Solved

Getting error msg 'No use provider could resolve identifier' when using sling model in HTL

  • January 4, 2017
  • 12 replies
  • 14303 views

Hi,

I've created a project using Maven Archetype 10 that has the below sample model object and htl file. The code was compiled and deployed to local repository using the mvn command: mvn -PautoInstallPackage install. Please note, the model object is in a seperate bundle.

**************************

package AEM62App.core.models;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.settings.SlingSettingsService;

@Model(adaptables=Resource.class)
public class HelloWorldModel {

    @Inject
    private SlingSettingsService settings;

    @Inject @Named("sling:resourceType") @Default(values="No resourceType")
    protected String resourceType;

    private String message;

    @PostConstruct
    protected void init() {
        message = "\tHello World!\n";
        message += "\tThis is instance: " + settings.getSlingId() + "\n";
        message += "\tResource type is: " + resourceType + "\n";
    }

    public String getMessage() {
        return message;
    }
}

*** and helloworld.html *******************

<p data-sly-test="${properties.text}">Text property: ${properties.text}</p>

<pre data-sly-use.hello="AEM62App.core.models.HelloWorldModel">
HelloWorldModel says:
${hello.message}
</pre>

*****

However, when helloworld component is invoked, it is throwing the below error. Please let me know if I'm missing anything.

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.sightly.SightlyException: No use provider could resolve identifier AEM62App.core.models.HelloWorldModel

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.sightly.SightlyException: No use provider could resolve identifier AEM62App.core.models.HelloWorldModel at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416) at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:546) at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77) at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:187) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:154) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:265) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:114) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282) at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322) at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211) at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104) at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:503) at com.adobe.cq.sightly.WCMScriptHelper.includeResource(WCMScriptHelper.java:165) at com.adobe.cq.sightly.internal.extensions.ResourceExtension.call(ResourceExtension.java:128) at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:66) at org.apache.sling.scripting.sightly.libs.wcm.foundation.components.parsys.SightlyJava_parsys.render(SightlyJava_parsys.java:229) at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderUnit.render(RenderUnit.java:54) at org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngine.evaluateScript(SightlyScriptEngine.java:92) at org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngine.eval(SightlyScriptEngine.java:78)

Regards,

Yogesh.

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

It means that the use-class can't be instantiated.

Can you try first to make the whole package-name lowercase?

It is normal to have the Java package in lowercase.

12 replies

Feike_Visser1
Employee
January 4, 2017

Did you verify that your bundle is active?

Feike_Visser1
Feike_Visser1Accepted solution
Employee
January 4, 2017

It means that the use-class can't be instantiated.

Can you try first to make the whole package-name lowercase?

It is normal to have the Java package in lowercase.

New Participant
July 25, 2023

I have make the whole package-name in lowercase but issue is not resolve.