Saturday 15 July 2017

A serious error occurred : Sitecore Experience Editor

Leave a Comment
Last week I have written a blog post about how to solve a mysterious Experience Editor error "An error occurred". This time I have again stumbled upon a similar error in experience editor (Sitecore 8.1 update 3).
A serious error occurred please contact the administrator.
As stated in my last blog post that there could be multiple reasons of such type of error. I’ve started the troubleshooting and noticed below two exceptions in log file:

Exception 1:
ERROR Error processing command url:/-/speak/request/v1/expeditor/ExperienceEditor.Social.SocialCenter.GetMessagesCount error:System.InvalidOperationException: Could not retrieve request class for url:/-/speak/request/v1/expeditor/ExperienceEditor.Social.SocialCenter.GetMessagesCount
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.Process(HttpContext context)
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.ProcessRequest(HttpContext context)

Exception 2:
ERROR Error processing command url:/-/speak/request/v1/expeditor/Optimization.ActiveItemTest error:System.InvalidOperationException: Could not retrieve request class for url:/-/speak/request/v1/expeditor/Optimization.ActiveItemTest
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.Process(HttpContext context)
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.ProcessRequest(HttpContext context)
Solving exception 1:
Exception 1 was related to Sitecore Social connect. We are using Sitecore in CMS only mode and have disabled Sitecore Social Connector config files. After troubleshooting, I’ve archived below item in core database so that it won’t appear in experience editor ribbon
/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Social
Solving exception 2:

Exception 2 was related to Sitecore Content Testing. We were not using Sitecore Content Testing and disabled all the App_Config\Include\ContentTesting\*.config files. After troubleshooting, I found that Content Testing related features are not completely disabled by disabling config files. I was able to disable content testing completely by disabling InjectOptimizationViewMode.js file. To disable js file, navigate to the \Website\sitecore\shell\client\Sitecore\ExperienceEditor\Pipelines\InitializePageEdit folder, and change the InjectOptimizationViewMode.js file extension to .disabled.

I hope this blog post is helpful to some of you and save few minutes of troubleshooting. If this solution doesn’t help you then make sure to check out other blogs/SO posts related to this error as there can be other reasons for this “A serious error occurred please contact the administrator” error.  Comments and suggestions are most welcome. Happy coding! 
Read More...

Saturday 8 July 2017

An error occurred : Sitecore Experience Editor

Leave a Comment
Lately, I have been involved in Sitecore upgradation project and I ran into below error in Sitecore experience editor after upgradation to Sitecore 8.1 Update 3.
An error occurred
The problem appeared in all web browsers. A quick google search has pointed me to various blogs/SO posts related to this error. Unfortunately, these posts don’t help me in rectifying this error. Therefore I have decided to write a quick blog post for those experiencing same error. I was not seeing any javascript related issues in browser console window. I have started deeper investigation in Sitecore logs files and found that below exception was getting logged:
ERROR Could not map index document field to property "UpdatedDate" on type  : String was not recognized as a valid DateTime.
Exception: System.FormatException
Message: Could not map index document field to property "UpdatedDate" on type Sitecore.ContentTesting.ContentSearch.Models.SuggestedTestSearchResultItem : String was not recognized as a valid DateTime.
Source: Sitecore.ContentSearch
   at Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(Object target, String propertyName, String documentFieldName, Object value)
   at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapFieldValuesToType[TElement](IDictionary`2 fieldValues, TElement result, DocumentTypeMapInfo documentTypeMapInfo)
   at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapToType[TElement](TDocument document, SelectMethod selectMethod, IEnumerable`1 virtualFieldProcessors, IEnumerable`1 executionContexts, SearchSecurityOptions securityOptions)
   at Sitecore.ContentSearch.LuceneProvider.LuceneSearchResults`1.<GetSearchResults>d__a.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Sitecore.ContentTesting.ContentSearch.TestingSearch.GetSuggestedTests()
   at Sitecore.ContentTesting.Data.SitecoreContentTestStore.GetSuggestedTests(DataUri hostItemDataUri, String searchText)
   at Sitecore.ContentTesting.Requests.ExperienceEditor.SuggestedTestsCountRequest.ProcessRequest()
   at Sitecore.ExperienceEditor.Speak.Server.Requests.PipelineProcessorRequest`1.Process(RequestArgs requestArgs)

Nested Exception

Exception: System.FormatException
Message: String was not recognized as a valid DateTime.
Source: mscorlib
   at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
   at Sitecore.ContentSearch.Converters.IndexFieldDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Sitecore.ContentSearch.Converters.IndexFieldUtcDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Sitecore.ContentSearch.Converters.IndexFieldStorageValueFormatter.ReadFromIndexStorage(Object indexValue, String fieldName, Type destinationType)
   at Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(Object target, String propertyName, String documentFieldName, Object value)
This exception was related to Sitecore Content testing. We are using Sitecore in CMS only mode and not using Sitecore Content Testing feature. I’ve followed this KB article to disabled Content Testing in Sitecore 8.1 Update 3. I was still getting Experience editor error after changing the ContentTesting.AutomaticContentTesting.Enabled setting value to false in the App_Config\Include\ContentTesting\Sitecore.ContentTesting.config file. Therefore I have decided to disable OPTIMIZATION ribbon strip which is related to Content Testing functionality. Archive the /sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Optimization item in the core database. It will completely disable the Optimization tab in the Experience Editor.
There are Attributes and PageProfileSettings chunks on this tab that are not related to Content Testing. If you use these chunks, you can move the following items:
/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Optimization/PageProfileSettings
/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Optimization/Attributes
under the /sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Experience item.
After following the instructions above, I no longer saw the Content testing related exception in log files and “An error occurred” notification is also disappeared in the Experience Editor.

I hope this blog post is helpful to some of you and save few minutes of troubleshooting. If this solution doesn’t help you then make sure to check out other blogs/SO posts related to this error as there can be other reasons for this “An error occurred” error.  Comments and suggestions are most welcome. Happy coding!

Update:
 I've blogged about my second encounter with similar error in experience editor. Read it here.
Read More...