Hi All,
How can I compile a java class created under a component definition. I am trying to use a WCMUse class in sightly to get an object from java class which I created under the component definition. I tried another way of creating a WCMUse java class in eclipse multi-module project but it is throwing "No use provider could resolve identifier: com.pro.eLearning.core.impl.servlets.CourseDisplay" error. Please help me.
Please do let me know if you need anymore information.
Best Regards
M. Ramana Reddy
Solved! Go to Solution.
@Reference will only work with your OSGI Component java files. you won't be able to use @Reference in your AEM component classes that is extending WCMUse.
To get OSGI Component reference in WCMUse class, do the following:
- Runal
See the following community article. It talks about how to create a Sightly component that compiles a Java class that uses com.adobe.cq.sightly.WCMUse.
See:
Creating your first Adobe Experience Manager Sightly component
Thanks for the reply. Actually if the java file don't have any @Reference annotation. it is working correctly. But If add that annotation then it is giving a compilation error "
Only a type can be imported. org.apache.felix.scr.annotations.Reference resolves to a package Reference cannot be resolved to a type
"
Is there anything wrong I am doing here??? please help me.
Views
Replies
Total Likes
@Reference will only work with your OSGI Component java files. you won't be able to use @Reference in your AEM component classes that is extending WCMUse.
To get OSGI Component reference in WCMUse class, do the following:
- Runal
it means that the interface that you have used with @reference is not present.
are you using your own service or CQ service with @Reference ?
I am using Adobe API' @Reference annotation. This error is coming when I use my OSGi bundle class file also BSLOKI.
Views
Replies
Total Likes
Thanks for reply Runal. Sorry for the silly question. How can i get FullyClassifiedBundleComponentClassPath. Right now I am having a class in org.company.module.classname. I am trying to use like this.
SlingScriptHelper sling = getSlingScriptHelper(); <fully qualified classname> helloService = sling.getService(<fuly qualified class name>.class);
Correct me if I am wrong. Are the FullyclassifiedBundleComponentClassPath and fullyQualifiedClassPath different?
please help me. Thanks.
Views
Replies
Total Likes
Yup its fullyQualified and not classified :) that was the typo mistake thanks for correcting.
Glad it helped you.
- Runal
Views
Replies
Total Likes
Runal.Trivedi wrote...
Yup its fullyQualified and not classified :) that was the typo mistake thanks for correcting.
Glad it helped you.
- Runal
I have my custom method in the service interface and implemented that method in the implementation class. But It is throwing error like the custom method undefined for the service. Is there anything I have to do here. There is a method in the interface which was created while creating the project by the aem plugin. If I call that method it i working like a charm. But not the methods added by me. Is there any process for adding the methods to the service interface??
Your Patience and Help are much appreciated.
Views
Replies
Total Likes
If you create a Java-class at component level, make sure the package is like apps.yourproject.components.yourcomponents.
It must match the location of the Java-class.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies