We are seeing an issue in multiple environments where Sitecron sometimes fails to initialize. In the log files, we see the following:

4072 16:16:03 INFO  Initialize Sitecron
4072 16:16:10 ERROR Sitecron ERROR: Object reference not set to an instance of an object.

Unfortunately, Sitecron does not log a full stack trace, so it is difficult to know what is going wrong. Looking at the code, I can see that this must happen before it attempts to load job definition items from Sitecore. Otherwise, I would see additional messages in the log. Currently, it seems to me that either the call to StdSchedulerFactory.GetDefaultScheduler() is returning null or the exception is being thrown within that call.

We are on Sitecore 8.2 update 2. We started seeing this error while using Sitecron 1.1.6, but I just upgraded to the latest version 2.2 in the hopes that it would help. Unfortunately, I saw the error again as soon as I deployed to the dev server.

What could be causing this intermittent error?

Note that the error only happens occasionally. After the initial failure, I can get it to initialize by updating a job item or by calling the ScheduleHelper.InitializeScheduler() via SPE.

  • Ben which version are you using? and can you confirm all the necessary dll's and configs exist in your instance please. – ASura Feb 23 '18 at 13:32
  • Ben are you using Powershell commands? If so what version of Powershell is installed? – ASura Feb 23 '18 at 14:33
  • I updated the question with version info. The dlls and configs are all there. – Ben Golden Feb 23 '18 at 14:34
  • No Powershell commands. I just upgraded to a version that had that feature yesterday. – Ben Golden Feb 23 '18 at 14:35
  • Very odd, I can release a version to log the stack trace. If you have the github for SiteCron you can try and deploy it faster to test. – ASura Feb 23 '18 at 14:40

It turns out that this problem didn't really have anything to do with Sitecron. It was due to a bug in Sitecore Commerce 8.2.1.

The CatalogDataProvider in Sitecore Commerce 8.2.1 generates templates the first time items are requested from the database. This is the same template generation process that you can trigger manually via the Update Data Templates button on the Sitecore Commerce ribbon in the Content Editor. After templates are generated, it raises an event to clear the template engine cache.

The problem is, at application start, this process is triggered by the template engine trying to load its templates. So essentially, the template engine is reset in the middle of its initialization process which results in a null reference exception.

This was confirmed as a bug by Sitecore Support and assigned reference number 37009. As far as I can tell, the code in question was removed for SXC 9.0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.