Skip to content
May 1, 2013 / kiranpatils

Exception while handling event Sitecore.Publishing.StartPublishingRemoteEvent

Challenge:

Last week, whenever we tried to publish anything in our local development environment, publishing was being shown as “Queued” and it was never publishing an item. When we had a look at log file, we found following error:

Heartbeat 10:25:07 ERROR Exception while handling event Sitecore.Publishing.StartPublishingRemoteEvent
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
at Sitecore.Publishing.PublishOptions.GetPublishingTargets()
at Sitecore.Publishing.PublishOptions..ctor(Database sourceDatabase, Database targetDatabase, PublishMode mode, Language
language, DateTime publishDate)
at Sitecore.Publishing.DistributedPublishingManager.DecodeOptions(DistributedPublishOptions options)
at Sitecore.Publishing.DistributedPublishingManager.GetOptions(DistributedPublishOptions[] options)
at Sitecore.Publishing.DistributedPublishingManager.StartPublishing(StartPublishingRemoteEvent event)
at Sitecore.Publishing.RemotePublishingEventHandler.OnStartPublishing(Object sender, EventArgs args)

You are also facing the same error? And struggling to find a solution! (So, as we did last week!). Then this post is for you only!

Solution:

Rather than sharing solution only, we would like to share full troubleshooting way with you.  So, during such challenges, you will be able to know what to check and what not to check during! 🙂 (Because, it takes lot of time to learn, what not to do. And once you learn that you can do anything!)

  1. By looking at error message “System.NullReferenceException ……. Sitecore.Publishing.PublishOptions.GetPublishingTargets()” you may quickly say that — Publishing targets items do not exist in Database. But my dear friend, we verified it for you and they do exist!
  2. When we disabled EventQueue then it worked fine! (Sorry, you are new to EventQueue, no worries — read my earlier post on EventQueue basics) So, something with EventQueue for sure and error message also says so!
  3. Tried same with Plain Sitecore (A good step to follow every time!) – and it was working fine with plain Sitecore. So, for sure something with our application only!
  4. Create a simple page, which published item programmatically and also tried to access publishing targets programmatically, the way it does in publish dialog and it worked!

Tried to had a word with our common friend — Google, and the thing which happens very less happened — Google said I don’t know! 😦 (And that was the motivation behind writing this blog post!)

Then we thought to discus this challenge with our best friends in Sitecore planet — Sitecore support champs!. But as per Sitecore developer’s best practice, It’s always good to have a look at SDN forum (Where all Sitecore friends — discuss their challenges with each other and help them to get out of it! — It’s a great forum) and it turned to be our indeed friend! (Because, a friend in need is a friend in-deed!)

http://sdn.sitecore.net/Forum/ShowPost.aspx?postid=46582

Above link helped us to find a solution!

“Interesting, I wanted to try the security disabler test in isolation and it fixes the problem, so it seems there is something going on with security after all, the context user is default/Anonymous and looking at permissions… In this instance default/Anonymous has not been granted read access to the sitecore Item.

I’ve tested a few other instances and in those read access has been granted on the sitecore Item for default/Anonymous

I don’t know how that happened, I certainly did not edit permissions on the sitecore Item

Thanks for the suggestion Steve “

Basically the reason for this error is access rights only.

So, we had a look in our Database (Master) and found that rights for default\anonymous was removed for /sitecore item. We assigned it and it worked like a charm!

Happy Publishing! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: