7

I am creating Solr Sitecore search index. After index was added to Solr and Sitecore configuration was updated to connect to it, I suddenly got yellow screen of death:

Connection error to search provider [Solr] : Unable to connect to [http://localhost:8983/solr], Core: [mycore]

With this call stack:

[SearchProviderConnectionException: Connection error to search provider [Solr] : Unable to connect to [http://localhost:8983/solr], Core: [mycore]]
   Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Initialize() +961
   Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.Initialize() +169
   Sitecore.ContentSearch.SolrProvider.UnityIntegration.UnitySolrStartUp.Initialize() +1506

[HttpException (0x80004005): Connection error to search provider [Solr] : Unable to connect to [http://localhost:8983/solr], Core: [mycore]]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +540
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Connection error to search provider [Solr] : Unable to connect to [http://localhost:8983/solr], Core: [mycore]]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731

Checked Sitecore logs. There is another call stack there, but at the end it is the same 404 Solr error:

10832 17:31:14 ERROR Unable to connect to [http://localhost:8983/solr], Core: [mycore]
Exception: SolrNet.Exceptions.SolrConnectionException
Message: The remote server returned an error: (404) Not Found.
Source: SolrNet
   at SolrNet.Impl.PostSolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrBasicServer`1.GetSchema()
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Initialize()

Nested Exception

Exception: System.Net.WebException
Message: The remote server returned an error: (404) Not Found.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at SolrNet.Impl.PostSolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)

When I try to check that URL in browser everything works fine. Tried all these URLs below and all them returned 200 with expected page or XML data:

13

After spending some time in Sitecore logs and googling I decided to check Solr logs.

In my case they are stored in C:\solr\solr-5.4.1\server\logs\

That was smart move. I immediately found a clue:

2016-10-12 21:21:34.271 INFO (qtp7980742-52) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/cores params={core=mycore&action=STATUS&version=2.2} status=0 QTime=10 2016-10-12 21:21:34.284 ERROR (qtp7980742-54) [
x:mycore] o.a.s.h.a.ShowFileRequestHandler Can not find: schema.xml [C:\solr\solr-5.4.1\server\solr\mycore\conf\schema.xml]

It happened that I copied schema.xml file to wrong location. After moving it to mycore\conf and restarting site everything returned back to normal.

I hope Sitecore can make that error message more helpful in next release.

  • 1
    I'm not sure Sitecore can improve that message, it sounds like Solr was responding to Sitecore with a 404 as Solr couldn't find the core, either. – Laver Oct 13 '16 at 22:09
3

Have you also tried what happened when you restart solr. If you setup the persistence wrong, you will eventually get the same error. Let me know if you need aasistance

  • 1
    After I moved schema.xml to right place it is not wrong anymore. Works fine after restart. Thanks for proposing help. – Dmitry Harnitski Oct 13 '16 at 11:01
2

I had the same error before. Error description found in sitecore log about solr issues is indeed vague and does not help much. What worked for me is by checking these files:

  • Sitecore.ContentSearch.Solr.Index.Master.config
  • Sitecore.ContentSearch.Solr.Index.Web.config

which can be found in /App_Config/Sitecore/ContentSearch/ folder. I checked the <Param> nodes and found out that the index name has been accidentally changed by other developers so I changed it back to its original value and the issue is solved. So if there is something wrong with ContentSearch settings, sitecore would give you the same generic error log message. Hope this would help.

1

Please Also note that we can get this kind of error if we mistakenly enable solr cloud config. If we are not using Solr Cloud, then solr cloud configuration should be disabled. (By default it's in disabled mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.