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.

2016-06-08_0851

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.

2016-06-08_1038

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.

2016-07-01_1153

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 :)

 

 

Share thisEmail this to someonePrint this pageTweet about this on Twitter0Share on Facebook0Share on Google+0Share on TumblrShare on LinkedIn0
0 votes

Leave a Reply

Your email address will not be published. Required fields are marked *


five × = 15

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>