Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

No use provider could resolve identifier

Avatar

Level 2

Hi,

I'm trying to use custom functions that I wrote in core project in utility folder.

i'm getting the following error when i refer the class in a component.

 

org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension No use provider could resolve identifier org.xxx.xxx.core.utility.HelperFunctions

My method looks like this:

----------------------------------------------------------------------------------------------------------------------------------------------------------------

package org.xxx.xxx.core.utility;

import com.adobe.cq.sightly.WCMUse;

public class HelperFunctions extends WCMUse{

    private String lowerCaseTitle;
    private String lowerCaseDescription;
  
    @Override
    public void activate() throws Exception {
        lowerCaseTitle = "Hi World title";
        lowerCaseDescription = "Hello World Description";
    }
  
    public String getLowerCaseTitle() {
        return lowerCaseTitle;
    }
    public String getLowerCaseDescription() {
        return lowerCaseDescription;
    }   

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

I'm referring in my component like this:

            <div data-sly-use.myhelp="org.xxx.xxx.core.utility.HelperFunctions">
                <p>
                    ${myhelp.lowerCaseTitle}
                </p>
                <p>
                    ${myhelp.lowerCaseDescription}
                </p>
            </div>

----------------------------------------------------------------------------------------------------------------------------------------------------------------

When i move this helper function to the component location where im using, my function is working. but when i use it from core project, im getting the above error.

Thanks for the help in advance!

1 Accepted Solution

Avatar

Correct answer by
Level 2

Sid Mup wrote...

Hi,

I'm trying to use custom functions that I wrote in core project in utility folder.

i'm getting the following error when i refer the class in a component.

 

org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension No use provider could resolve identifier org.xxx.xxx.core.utility.HelperFunctions

My method looks like this:

----------------------------------------------------------------------------------------------------------------------------------------------------------------

package org.xxx.xxx.core.utility;

import com.adobe.cq.sightly.WCMUse;

public class HelperFunctions extends WCMUse{

    private String lowerCaseTitle;
    private String lowerCaseDescription;
  
    @Override
    public void activate() throws Exception {
        lowerCaseTitle = "Hi World title";
        lowerCaseDescription = "Hello World Description";
    }
  
    public String getLowerCaseTitle() {
        return lowerCaseTitle;
    }
    public String getLowerCaseDescription() {
        return lowerCaseDescription;
    }   

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

I'm referring in my component like this:

            <div data-sly-use.myhelp="org.xxx.xxx.core.utility.HelperFunctions">
                <p>
                    ${myhelp.lowerCaseTitle}
                </p>
                <p>
                    ${myhelp.lowerCaseDescription}
                </p>
            </div>

----------------------------------------------------------------------------------------------------------------------------------------------------------------

When i move this helper function to the component location where im using, my function is working. but when i use it from core project, im getting the above error.

Thanks for the help in advance!

 

 

I found the issue.

When im creating my eclipse project with AEM sample template,  i gave artifacts id with a capital letter. It seems, if artifacts Id has a capital letter, its not throwing any error, but all there java classes i added in core is not getting reffered. even default home page functions also not working.

So i created a new project with artifacts id all small letters, all my java functions in core started working.

it must be some bug or it a requirement that artifact ID cannot start with a capital letter.

Old artifact id: "Studio"

New artifact id: "studio"

 

Hope this helps if any body is facing the same issue. It took me 2 days to figure it out. 

 

Thanks,

Siddhartha Mupparaju

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Sid Mup wrote...

Hi,

I'm trying to use custom functions that I wrote in core project in utility folder.

i'm getting the following error when i refer the class in a component.

 

org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension No use provider could resolve identifier org.xxx.xxx.core.utility.HelperFunctions

My method looks like this:

----------------------------------------------------------------------------------------------------------------------------------------------------------------

package org.xxx.xxx.core.utility;

import com.adobe.cq.sightly.WCMUse;

public class HelperFunctions extends WCMUse{

    private String lowerCaseTitle;
    private String lowerCaseDescription;
  
    @Override
    public void activate() throws Exception {
        lowerCaseTitle = "Hi World title";
        lowerCaseDescription = "Hello World Description";
    }
  
    public String getLowerCaseTitle() {
        return lowerCaseTitle;
    }
    public String getLowerCaseDescription() {
        return lowerCaseDescription;
    }   

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

I'm referring in my component like this:

            <div data-sly-use.myhelp="org.xxx.xxx.core.utility.HelperFunctions">
                <p>
                    ${myhelp.lowerCaseTitle}
                </p>
                <p>
                    ${myhelp.lowerCaseDescription}
                </p>
            </div>

----------------------------------------------------------------------------------------------------------------------------------------------------------------

When i move this helper function to the component location where im using, my function is working. but when i use it from core project, im getting the above error.

Thanks for the help in advance!

 

 

I found the issue.

When im creating my eclipse project with AEM sample template,  i gave artifacts id with a capital letter. It seems, if artifacts Id has a capital letter, its not throwing any error, but all there java classes i added in core is not getting reffered. even default home page functions also not working.

So i created a new project with artifacts id all small letters, all my java functions in core started working.

it must be some bug or it a requirement that artifact ID cannot start with a capital letter.

Old artifact id: "Studio"

New artifact id: "studio"

 

Hope this helps if any body is facing the same issue. It took me 2 days to figure it out. 

 

Thanks,

Siddhartha Mupparaju