System.Reflection.TargetInvocationException error when Rebuilding #Sitecore Solr Indexes

Hi All,

We have a multilingual #Sitecore site. When I was rebuilding the #Sitecore indexes, I was getting a weird error that is

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

2016-06-01 19_06_37-Bentley - Microsoft Visual Studio (Administrator)

Generally we click on cross button, and rebuild the index again, sometime it works. :P

But in my case it’s not working. So I dig into the issue.

First of all I just opened the local solr url in browser like this http://localhost:8983/solr/

And then click on logging button on the left side and saw there were so many errors as shown in the below image.


By looking into the image, we can see that there are some language specific error. Like “zh” for Chinese, “ko” for Korean.


So now what to do?


Then after some searching I found that we have to do something with physical solr files. Now go to solr folder where you have configured solr for your project. Let’s assume you have configured solr with the name “project_master” and “project_web”. So follow the steps –

1)      Go to “solr/project_master/conf” folder.

2)      Then you will find an xml file named “schema.xml” there.

3)      Open this schema.xml file in notepad or so and search for “dynamicField” that is under fields section.

If you don’t find schema.xml file in conf folder then you need to follow following steps –

1)      Go to sitename/Sitecore

2)      Log into Sitecore with username and password.

3)      Then click on Sitecore button that is in left bottom corner.

4)      Then navigate to Control Panel, a screen will popup like following image.


5)      In this there are 2 links, then you need to click on “Generate the Solr Schema.xml file”.

2016-06-01 19_11_21-Sitecore


6)      You will see there are 2 fields “Source File” and “Target File”.

7)      In the Source File you need to provide a default schema.xml file. You can download default schema.xml here.

8)      In the Target File provide the target folder, where you want it to be.

9)      Now you are ready to customize “schema.xml” file.


When you will open this schema.xml, you will find that lots of dynamic fields are there something like this –

<dynamicField name=”*_t” type=”text_general” indexed=”true” stored=”true” />


Note – Before making changes in schema.xml you need to take care of apache server. In your PC click on “Start” button and search for “Monitor Tomcat”, click on it. You need to click on “Stop service”, after that you can make changes in schema.xml file.


In these dynamic field search for “zh, ko”, and you will find that there are no entries with these names, so now we need to make entry for these language types like below image. Make sure you have entry for each language that is causing error.


What “*” means, it will include all the entries ending with e.g. “t_zh”.

There are several “dynamicField type” like text_general, string, boolean, int, date, location, tint, tlong, tfloat, tdouble, tdate, pint, currency, ignored, random etc. I am using “text_general” here.


It’s done, no. There is still something we need to do.

Start you Tomcat (Apache) service again by opening Monitor Tomcat.

Now you again need to go to #Sitecore and rebuild your index again.

Finally it’s done now.

If you got error again, then you need to follow this process again then check the logging and make sure all language specific entries are there.

Thanks to Ravindra Singh Rathore, he helps me in this as well.

Happy Coding :)



Multiple datasource locations to Single Sublayout or Rendering in #Sitecore

Hello All,

In one of our project I faced a requirement to give multiple Datasource location to single Rendering, so that they can select whatever datasource they need. After doing some research I found that it is possible to give multiple datasource. For this first of all Login to your Sitecore.

Let’s say you have a #Sitecore structure like this -



-Site Node


-Datasource Folder



-Datasource Folder

-Item 1


-Datasource Folder


Now we need to set 2 Datasource Locations for single Rendering. For this follow the below steps-

1)      Go to particular rendering where you want to set datasource

2)      Let’s say go to





-Your Rendering

3)      Click on “Your Rendering”

4)      Then in right hand side go to “Editor Options”

5)      Firstly, go to “Datasource Template” field.

Click on “Insert Link”, a pop up will open, in which you need to select “Datasource Folder Template”



6)      In “Editor Options” go to “Datasource Location” field

7)      Then in the “Datasource Location” write this query –

. /_Resource|query:./ancestor-or-self::*[@@templatename=Site Node Template Name'] /*[@@templatename='Globals Folder Template Name']/*[@@templatename=Datasource Template']


What does this query means –

1)      This query is divided by pipe sign (|)

2)      In which “_Resource” is the first datasource location (Left part of pipe sign (|)), that is let’s say we want to give datasource to “Home” item’s rendering. So first you can see there is “_Resource” folder directly under “Home” item, so it is the path of that “_Resource” folder

3)       Now we have 2nd datasource location (Right part of pipe sign (|)), that is a query. In this query you need to set “Template Names”. Let’s say you want to set 2nd location to “Datasource Folder” that is under “Globals” Folder. So all you need to do is to set “Template Name” starting from your “Site Node” to that “Globals Folder Template”, don’t include datasource folder template in this. If your datasource is under any other node under Globals folder, then need to set template names just above your datasource folder.

For ex – Your sitecore tree is like – sitecore/content/sitenode/globals/datasource folder, so set template names starting from sitenode template to globals folder.

4)      Here it is all. Now go to “Home” item.

5)      Click on “Presentation” tab.

6)      In that click on “Details”.

7)      A pop up will open in which click on “Your Rendering”

8)      Then in the “General” tab, go to “Data Source” field and click on “Browse”, now you can see there are 2 datasource location, in which you can select datasource from either Globals Folder’s Datasource or _Resource Folder’s Datasource.


Happy Coding :)