Most of the times, when you set up a CD server at some point or the other. You will see errors like ‘No matching constructor found….’
These nasty errors are hard to debug specifically if you have bunch of complex third party system’s interacting with your sitecore instance. I encountered something like this while setting up our pre-production environment with load balancer going on. If you choose to do trial and error, these errors could take for ever to resolve.
I applied a strategy and that seemed to get me to the problem more quickly. Also, I felt the strategy is generic, so, it could be applied to any error similar to this kind.
So, here is the error I had to battle –
Could not create instance of type: Sitecore.ContentSearch.LuceneProvider.LuceneIndex. No matching constructor was found.
Here are the steps I took to resolve this. Hopefully, it will help some one scrambling for a resolve.
Go to sitecoreinstance/sitecore/admin/showconfig.aspx and ensure there are no references to ‘master’ any where, since this is a CD after you enable Switch master to web config and you did a good job at it, you should not be seeing any references. If you do, then, revise your config.
After you eliminate #1, check for which constructor it is is complaining about. In my case it was Sitecore.ContentSearch.LuceneProvider.LuceneIndex. So, I pulled up the *.dll specific to this that comes with Sitecore installation using reflector.
If you notice – there are three constructors I could see from what reflector has to say – In this case the below:
protected LuceneIndex(string name);
public LuceneIndex(string name, string folder, IIndexPropertyStore propertyStore);
public LuceneIndex(string name, string folder, IIndexPropertyStore propertyStore, string group);
Next, I opened up sitecoreinstance/sitecore/admin/showconfig.aspx again and went through all entries on the config that inherit or have provider listed as Sitecore.ContentSearch.LuceneProvider.LuceneIndex to check and see if they are passing the params to adhere to one of the three the *.dll supports.
There were only about nine references, so, it was not such a pain to see each of those to compare. I found one entry that was not passing params per expectation. You should also see from which patch file this entry is coming from. Thank you Sitecore.
I deleted that entry as I did not need it as the original config file from which this index was originally defined was disabled per Sitecore set up instructions. But, in your case if you need that entry, ensure you are passing in params that would match atleast one constructor.
That’s all!! Error behind us and I could go back to sleep peacefully. This strategy could be applied to any error you will face. The fact is trial and error is not so much fun and application of clear strategy shows you understand what you are doing.
Hope this helps someone!!!