Scheduler Job throwing exceptions
I tried writing a scheduler job using the Job class but somehow it won't execute. It keeps throwing null as an exception. This is what I'm getting in logs :

This is the code that I've written :
package com.mysite.core.schedulers;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.apache.sling.commons.scheduler.Job;
import org.apache.sling.commons.scheduler.JobContext;
import org.apache.sling.commons.scheduler.ScheduleOptions;
import org.apache.sling.commons.scheduler.Scheduler;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.metatype.annotations.Designate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(immediate = true, service = Job.class)
@Designate(ocd = SchedulerConfigThree.class)
public class PracticeSchedulerDayThree implements Job {
private static final Logger LOG = LoggerFactory.getLogger(PracticeSchedulerDayThree.class);
private int schedulerId;
@Reference
private Scheduler scheduler;
@Activate
protected void activate(SchedulerConfigThree configThree) {
schedulerId = configThree.schedulerDayThreeName().hashCode();
ScheduleOptions in = scheduler.EXPR("0 56 23 1/1 * ? *");
Map<String, Serializable> inMap = new HashMap<>();
inMap.put("country", "India");
inMap.put("URL", "www.india.com");
scheduler.schedule(this, in);
ScheduleOptions de = scheduler.EXPR("0 59 23 1/1 * ? *");
Map<String, Serializable> deMap = new HashMap<>();
deMap.put("country", "Denmark");
deMap.put("URL", "www.de.com");
scheduler.schedule(this, de);
}
@Deactivate
protected void deactivate() {
scheduler.unschedule(String.valueOf(schedulerId));
}
@Override
public void execute(JobContext jobContext) {
LOG.info("\n ===> COUNTRY : URL {} : {}", jobContext.getConfiguration().get("country"), jobContext.getConfiguration().get("URL"));
}
}Can someone please let me know what am I doing wrong over here?
