PublisherQueueJob: NullPointerException every minute if OSGi Framework restarted with Quartz job plugin present
dotCMS 2.5
If the "Restart Framework" action is used through the admin UI when a plug-in which schedules an org.quartz.Job is already in the dotCMS/WEB-INF/felix/load directory, this error is logged every minute:
[17/09/13 10:49:00:013 UTC] ERROR business.PublisherQueueJob:
java.lang.NullPointerException
at org.apache.felix.framework.BundleRevisionImpl.getResourcesLocal(BundleRevisionImpl.java:531)
at org.apache.felix.framework.BundleWiringImpl.findResourcesByDelegation(BundleWiringImpl.java:1173)
at org.apache.felix.framework.BundleWiringImpl.getResourcesByDelegation(BundleWiringImpl.java:1083)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5.getResources(BundleWiringImpl.java:1870)
at com.dotmarketing.osgi.CombinedLoader.getResources(CombinedLoader.java:112)
at com.sun.jersey.spi.service.ServiceFinder.getResources(ServiceFinder.java:352)
at com.sun.jersey.spi.service.ServiceFinder.access$200(ServiceFinder.java:159)
at com.sun.jersey.spi.service.ServiceFinder$AbstractLazyIterator.setConfigs(ServiceFinder.java:720)
at com.sun.jersey.spi.service.ServiceFinder$AbstractLazyIterator.hasNext(ServiceFinder.java:732)
at com.sun.jersey.spi.service.ServiceFinder.toClassArray(ServiceFinder.java:595)
at com.sun.jersey.api.client.Client.init(Client.java:213)
at com.sun.jersey.api.client.Client.access$000(Client.java:118)
at com.sun.jersey.api.client.Client$1.f(Client.java:191)
at com.sun.jersey.api.client.Client$1.f(Client.java:187)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:187)
at com.sun.jersey.api.client.Client.<init>(Client.java:170)
at com.sun.jersey.api.client.Client.create(Client.java:679)
at com.dotcms.publisher.business.PublisherQueueJob.updateAuditStatus(PublisherQueueJob.java:153)
at com.dotcms.publisher.business.PublisherQueueJob.execute(PublisherQueueJob.java:58)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
It can be easily reproduced by starting dotCMS with the example job dynamic plug-in present in the felix/load directory, then clicking "Restart Framework" in the Dynamic Plugins menu of admin UI.
I believe the classloader resources for the bundle do not un-publish properly when the framework is restarted, so the PubilsherQueueJob is still trying to access them through the CombindedLoader class every minute. Once the error has started being logged it requires a dotCMS service restart to resolve.
@spq2 i imagine if you undeployed and redployed the quartz bundle it would work for you
@spq2 we have tried on latest master-2.5 to reproduce in Eclipse AND running from the command line normally.
We cannot. Make sure you are not in your IDE. Maybe you have some other environment but we are able to reproduce with the https://github.com/dotCMS/dotCMS/tree/master/docs/examples/osgi/com.dotcms.job job