The following error is observed in the AEM log files:
31.05.2017 17:00:00.003 *ERROR* [sling-default-1000-HourlySnapshotJob] org.apache.sling.commons.scheduler.impl.QuartzScheduler Exception during job execution of com.day.cq.reporting.impl.snapshots.SnapshotServiceImpl$2@1a639a76 : null java.lang.NullPointerException: null at org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.getResourceResolver(JcrResourceResolverFactoryImpl.java:125) at org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.getResourceResolver(JcrResourceResolverFactoryImpl.java:94) at com.day.cq.reporting.impl.snapshots.SnapshotServiceImpl.executeSnapshot(SnapshotServiceImpl.java:274) at com.day.cq.reporting.impl.snapshots.SnapshotServiceImpl$2.run(SnapshotServiceImpl.java:160) at org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(QuartzJobExecutor.java:118) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
This happens when a class holds reference to a JcrResourceResolverFactory class instance which was deactivated. When a component is deactivated and activated again, a new instance is created. Therefore, if someone keeps hold of the old instance, the references are null and never set again. This NullPointerException happens when a method call is made on a field injected via Felix SCR. The field should really have a value since the method call was initiated from an activate() call which is also initiated by SCR.
This issue is resolved in version 2.0.8 of the Apache Felix SCR library. To fix the issue, install the newer version: