Sheduled job does not work anymore (Scheduling service [java.lang.Runnable] failed)
The logfile error.log shows me following error:
18.10.2022 14:20:44.980 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=xx.xxx.MyCronJob)] xx.xxx.my-bundle Service [xx.xxx.MyCronJob,9912, [java.lang.Runnable]] ServiceEvent UNREGISTERING
18.10.2022 14:20:44.985 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent: pid=xx.xxx.MyCronJob)] org.apache.sling.commons.scheduler.impl.WhiteboardHandler Scheduling service [java.lang.Runnable] failed.
18.10.2022 14:20:44.985 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=xx.xxx.MyCronJob)] xx.xxx.my-bundle Service [xx.xxx.MyCronJob,9913, [java.lang.Runnable]] ServiceEvent REGISTERED
The configuration class looks so:
public @interface MyCronJobConfig {
@AttributeDefinition(name = "Cron Pattern", description = "...")
String scheduler_expression() default "0 30 2 * * *";
@AttributeDefinition(name = "Concurrent Jobs", description = "...", type = AttributeType.BOOLEAN)
boolean scheduler_concurrent() default true;
@AttributeDefinition(name = "Enabled", description = "...", type = AttributeType.BOOLEAN)
boolean enabled() default true;
}
And the business logic:
@8220494(service = Runnable.class, immediate = true, configurationPolicy = ConfigurationPolicy.REQUIRE)
@Designate(ocd = MyCronJobConfig.class)
@Slf4j
public class MyCronJob implements Runnable {
private BundleContext bundleContext;
protected void activate(ComponentContext componentContext) throws Exception {
this.bundleContext = componentContext.getBundleContext();
log.info("cron job activated.");
}
public void run() {
log.info("cron job started.");
log.info("cron job finished.");
}
}
The problem is, the run() method won't be executed. I can see it while no log output does appear in log file. Where is my mistake?
Thanks for your help.
