2

SXA v1.7.1 with Sitecore v9.0.2

I'm regularly getting this error in Sitecore when trying to publish after I have restructured some items in master database. If I delete the modified sub-tree from web database and try to publish again then everything works fine.

Error as below -

17576 00:00:00 ERROR One or more exceptions occurred while processing the subscribers to the 'item:moving' event.
Exception[1]: System.NullReferenceException 
Message[1]: Object reference not set to an instance of an object. 
Source[1]: Sitecore.XA.Foundation.Multisite 
   at Sitecore.XA.Foundation.Multisite.EventHandlers.VirtualMediaFolderValidator.OnItemMoving(Object obj, EventArgs args)
   at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) 

Do anyone have any solution or workaround for this?

5

This is a known bug. You should contact Support to get the patch (you can use reference number 13144).

The reason is that in the OnItemMoving function in the VirtualMediaFolderValidator class from SXA, this line: Database contentDatabase = ServiceLocator.ServiceProvider.GetService<IContext>().ContentDatabase; does not work when running in a publish job, as there is no ContentDatabase.

2

As Gatogordo said, definitely contact Support to receive the official patch

In the meantime, what you can do to get past this is patch this to your configuration:

  <events>
        <event name="item:adding">
            <handler type="Sitecore.XA.Foundation.Multisite.EventHandlers.VirtualMediaFolderValidator, Sitecore.XA.Foundation.Multisite" method="OnItemAdding">
                <patch:delete />
            </handler>
        </event>
        <event name="item:moving">
            <handler type="Sitecore.XA.Foundation.Multisite.EventHandlers.VirtualMediaFolderValidator, Sitecore.XA.Foundation.Multisite" method="OnItemMoving">
                <patch:delete />                                                                                                                               
            </handler>
        </event>
    </events>

This will effectively disable the VirtualMediaFolderValidator while you wait for the official fix.

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.