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

Scheduler is not Visible in Sling Scheduler console: Scheduler is not working

Avatar

Level 2

avi_infy_1-1673092401121.png

The circled one is my scheduler.

 

But below when i see, i only see the default scheduler.

avi_infy_2-1673092484994.png

 

Any Help would be Highly appreciated.

Currently I'm using AEM 6.5.13.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You have to use ResourceResolverFactory to get ResourceResolver object. It is not possible to get ResourceResolver object via @reference in OSGi component/service

@ Reference
private ResourceResolverFactory resourceResolverFactory

 Please also confirm if above finding was the root cause, as I pointed out.

View solution in original post

13 Replies

Avatar

Level 9

Could you please check the cron expression, if you have wrong expression you cannot see that in scheduler console

Also check if all the Reference services are up and running

Refer this sample example for end to end scheduler code

https://aem.redquark.org/2018/10/day-13-schedulers-in-aem.html?m=1

Avatar

Level 2

Sure, I'm providing the screenshot of my sample code.

avi_infy_0-1673262707332.pngavi_infy_1-1673262729833.pngavi_infy_2-1673262760636.png

 

Here is my configuration class:

avi_infy_3-1673262800938.png

 

Avatar

Level 4

Please check your scheduler with

1.  cron expression is correct or not or add default one for testing

2. please status in Felix console active or not.

3.  Check dependent services are active or satisfied state.

4.  Put some logs to validate initialization.

Avatar

Level 2

1.  cron expression is correct or not or add default one for testing : Checked this, this one is correct, I'm Using cron expression from cronmakker.in

2. please status in Felix console active or not. : My Bundle is in active state

3.  Check dependent services are active or satisfied state.: Everything looks fine over here.

4.  Put some logs to validate initialization. : Check still, not able to get any thing in log.

Avatar

Level 2

@lukasz-m @arunpatidar Can you please help me, I have attached the screenshot of my sample code in Below comments.

Avatar

Level 2

Tried this as well, but it did'nt worked

The thing is when i place my logic of void run, under void run() of your of code which you have provided. The scheduler disappear in Sling scheduler console.

Avatar

Community Advisor

Hi @avi_infy,

The problem is that line:

 

@Reference
private Resource resource;

 

Your OSGi component most likely did not start is not satisfied, because it was not possible to get above reference. You can confirm component status under /system/console/components.

Unfortunately you can not get resource in above way. You will need ResourceResolver and path to resource. You can get ResourceResolver via ResourceResolverFactory.

Please remove above line from you code - this will allow you to confirm that this is a root cause.

Avatar

Level 2

Can I use 

@ Reference
private ResourceResolver resourceResolver; directly, or i have to only get it through ResourceResolverFactory?

 

Avatar

Correct answer by
Community Advisor

You have to use ResourceResolverFactory to get ResourceResolver object. It is not possible to get ResourceResolver object via @reference in OSGi component/service

@ Reference
private ResourceResolverFactory resourceResolverFactory

 Please also confirm if above finding was the root cause, as I pointed out.