Skip to main content

Posts

My Contributions to Sitecore Community in 2023

Hello!! This year started with a bang for me as I got my first Sitecore MVP title. This year, I have mostly worked on Sitecore 10.1.1 as part of IT team of an accounting services organization. Due to my nature of work, I dont have exposure to different projects exploring variety of new Sitecore tools and technologies (like my other fellow MVPs have), but I have used this year to upgrade my learning and dig deeper into Sitecore XP on which I primarily work. Below are my contributions this year -  Sitecore Blogs Below are the links to all my blogs which I have published in year 2022 on Sitecore.  https://ghanendras.blogspot.com/2023/02/experience-of-first-time-sitecore-mvp.html https://ghanendras.blogspot.com/2023/02/make-sitecore-instance-faster-using.html https://ghanendras.blogspot.com/2023/03/solr-search-facet-values-limited-to-100.html https://ghanendras.blogspot.com/2023/06/testing-sitecore-with-selenium-nunit.html https://ghanendras.blogspot.com/2023/08/animated-gif-files-become-n

No root node was present (with Id 11111111-1111-1111-1111-111111111111) - Error in Sitecore Publishing service job

 The Problem I was setting up publishing service for Sitecore instance and then published a few items but my publish jobs kept failing as in snapshot below -  I found below error in publishing service logs - 2023-11-08 23:00:26.790 +05:30 [Error] There was an error performing the publish during stage: "" System.AggregateException: One or more errors occurred. (One or more errors occurred. (No root node was present (with Id 11111111-1111-1111-1111-111111111111). (Parameter 'allNodes')))  ---> System.AggregateException: One or more errors occurred. (No root node was present (with Id 11111111-1111-1111-1111-111111111111). (Parameter 'allNodes'))  ---> System.ArgumentOutOfRangeException: No root node was present (with Id 11111111-1111-1111-1111-111111111111). (Parameter 'allNodes')    at Sitecore.Framework.Publishing.Common.DataStructures.Tree.TreeBuilder`2.Build(ITreeNodeDescriptor`2[] allNodes)    at Sitecore.Framework.Publishing.ItemIndex.FullSour

Solr Service in Paused State during Sitecore installation

 The Problem I was working on Sitecore installation on a new machine. Everything was running smooth but the SOLR service always ended up in PAUSED state.  The Research I tried stopping the service and then starting it using NSSM multiple times but it did not help. Then I thought of removing and recreating the service but again no help. And then it was followed by a machine restart and the service still ended up in PAUSED state.  I started googling about this issue and found answers suggesting that may be JAVA_HOME environment variable is not set or may be JAVA is not installed. I opened my command prompt to execute  echo %java_home% to get value for JAVA_HOME environment variable and it returned a blank value. This proved there is definitely an issue with JAVA setup on my new machine. Next,  I executed  java -version in cmd prompt and I found that the new machine is using Microsoft build of openJDK   instead of JRE (snapshot below) It was found that new machine is using openJDK because

Sitecore PowerShell script to update Allowed Controls field in placeholder settings

The Problem We created a new module (or component or rendering) in Sitecore and we needed to add this rendering to Allowed Controls field in the placeholder settings in Sitecore. It is also required to allow this rendering on all the placeholders in Sitecore so that content authors have the ability to add this rendering on pages in experience editor. Below is a snapshot of the field that is used for this- If the placeholders were in limited number, it would have been an easy manual job. But we had more than 20 placeholders for different page types. And we were in a process of introducing several new modules which meant this task is going to be repetitive and time consuming. So, to save time and for accuracy, we decided that we should develop a simple PowerShell script to make this process simple. The Solution We developed below script -  $placeholders = Get-ChildItem "/sitecore/layout/Placeholder Settings/<path where your placeholders are present>" -recurse Foreach($pla

Sitecore Content Serialization error - The container is defined twice

The Problem If you use Sitecore Content Serialization to serialize your Sitecore items into yml files (and if you use Leprechaun to generate/update item models automatically in our solution), there are chances you may stumble upon the error as in the snapshot below -  The Solution If you have used Sitecore Content Serialization, then you will know that it makes use of a module.json file in which you specify details about what items to serialize. It usually looks something like this -  {   "namespace": "Feature.Sample",   "items": {     "includes": [       {         "name": "templates",         "path": "/sitecore/templates/Feature/Sample"       },       {         "name": "renderings",         "path": "/sitecore/layout/Renderings/Feature/Sample"       },       {         "name": "buttons",         "database": "core",         "

Publishing Service Failed: Could not resolve stores 'web' of type source

Problem While trying to publish an item using Sitecore Publishing Service, the publish job shows status as Failed (check snapshot below) and when user clicks on it to get more details, it says -  Could not resolve stores 'web' of type source Solution We checked the logs and it said -  2023-10-09 09:31:32.560 -04:00 [Error] Error during publish of 443f1620-188b-4f39-a9c8-ef284d9a6c6b - Error: "Could not resolve stores web of type source" System.Exception: Could not resolve stores web of type source at Sitecore.Framework.Publishing.Data.DefaultStoreFactory.CreateSources(DataAccessContextType dataAccessContext, String[] names) at Sitecore.Framework.Publishing.PublishContext..ctor(IStoreFactory storeFactory, PublishOptions publishOptions, Guid jobId, DateTime started) at Sitecore.Framework.Publishing.PublishContextFactory.Create(IStoreFactory storeFactory, PublishOptions publishOptions, Guid jobId, DateTime started) at Sitecore.Framework.Publishing.Tasks.Publi

String Interning in Sitecore

I am always looking at different ways of optimizing application resources in Sitecore. After all, low resources means low cost!! I came across the concept of String Interning and I got interested into it. Next, I was thinking how can I make use of it in my Sitecore instances. I started digging little bit and I found Sitecore is smart enough to already make use of it. I will share some of the findings in this post. What is String Interning?  In computer science, string interning is a method of storing only one copy of each distinct string value, which must be immutable.  What this means is if you have a string object str1 with value "Hello" and then if your code initializes another string object str2 with same value "Hello", string interning will prevent creation of second object for str2 as String Constants Pool already has a string object with same value. It will assign the reference of str1 to str2 and str2 will reuse the object that was created for str1. This obv