Hi,
whenever I tried to call my service, from model class I am getting null. I tried annotating with @reference.
This is how I created the service @component (immediate = true, service = DashboardService.class), can anyone help me with this.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @HariniVR
In your service class try
@component (immediate = true, service = {DashboardService.class}, enabled=true)
After building and installing the code package at AEM, browse system/console/configMgr and confirm service is available at console.
In case service is not available probably the service is failing to initialize because of some other error. Check error logs to see if there is any failure related to your DashboardService
try using @OSGIService in sling model
@OSGiService
MyServiceClass myService
Hi @HariniVR
In your service class try
@component (immediate = true, service = {DashboardService.class}, enabled=true)
After building and installing the code package at AEM, browse system/console/configMgr and confirm service is available at console.
In case service is not available probably the service is failing to initialize because of some other error. Check error logs to see if there is any failure related to your DashboardService
As other pointed out, @reference is only used in Sling Servlets, OSGI Services and Schedulers.
Use @OSGiService annotation to inject your custom OSGI Service into Sling Model.
Make sure your OSGI Service is up and running by visting /system/console/component in the OSGI console.
Views
Likes
Replies