SolrCore Initialization Failures – xConnect Sitecore 9

Since Sitecore 9 was released a few weeks back, I’ve been digging into the new release and there are lots of new things to play with. One of the most interesting new features is xConnect, a framework of rich APIs and services that allows users to integrate customer interaction data collected by Sitecore with customer data from nearly any third-party system or channel.

xConnect brings with it a separately hosted IIS site, additional Solr cores and a couple of other applications more details are available in the Developer Center.

The release of Sitecore 9 also brought a new way to install Sitecore the Sitecore Installation Framework (SIF), you can read more about that in the installation guide.

After installing Sitecore 9 locally using SIF, I wanted to make changes to the connection strings used in the installation rather than using a sql user I wanted to use the App Pool user so I removed the user id and password and added Trusted_Connection=True;

This change ended up breaking my Solr core for xDB called {siteprefix}_xdb, the logs pointed to a Solr error and opening Solr showed the message :-

SolrCore Initialization Failures 
{siteprefix}_xdb: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error opening new searcher 
Please check your logs for more information

SolrCore-Initalization-Failure

So I checked my Solr logs – https://localhost:8983/solr/#/~logging and found some more details on the error.

 

Unable-to-create-core

The stack trace was

null:org.apache.solr.common.SolrException: Unable to create core [{SitePrefix}_xdb] at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:938)
at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1347)
at org.apache.solr.servlet.HttpSolrCall.init(HttpSolrCall.java:268)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:483)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)

 

Caused by: java.nio.file.FileAlreadyExistsException: C:\solr\server\solr\{SitePrefix}_xdb\data\index\write.lock
at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
at java.base/java.nio.file.Files.newByteChannel(Unknown Source)
at java.base/java.nio.file.Files.createFile(Unknown Source)
at org.apache.lucene.store.SimpleFSLockFactory.obtainFSLock(SimpleFSLockFactory.java:82)

 

The stack trace was pretty explicit Caused by: java.nio.file.FileAlreadyExistsException: C:\solr\server\solr{SitePrefix}xdb\data\index\write.lock _although I was not sure why they write.lock file was present. So I deleted the file and restarted my Solr service and the write.lock came back and the xDB core failed to start again.

 

SolrCore-Write-Lock

After some digging I found a config file I had missed out on updating for the Sitecore XConnect Search Indexer service, the config file was here for my install

C:\inetpub\wwwroot\{siteprefix}.xconnect\App_data\jobs\continuous\IndexWorker\App_config\ConnectionStrings.config

Once I updated the collection connectionstring

<add name="collection" connectionString="data source=(local);Initial Catalog={siteprefix}Xdb.Collection.ShardMapManager;TrustedConnection=True;" />

  • Restart the xConnect site: {siteprefix}.xconnect
  • Restart the Sitecore XConnect Search Indexer windows service
  • Deleted the log write.lock file from the the {siteprefix}_xdb and {siteprefix}_xdb_rebuild cores data directories
  • Restarted my Solr service

After this everything was happy and my Solr cores came back online.

The last step is manaully triggering a rebuild of the xDB core via the service with the command XConnectSearchIndexer -rr documented here – https://doc.sitecore.net/developers/xp/xconnect/xconnect-search-indexer/rebuild-index/rebuild-solr-index.html and you should get a success message from the service.

 

Rebuild-Indexes