Search code examples
javasolrdspace

Updating DSpace Solr index encounters this error: SolrCore 'search' is not available due to init failure


When I run the following command to update Solr index:

sh [dspace]/bin/dspace index-discovery

where [dspace] is the install directory of DSpace, I get the following error:

Exception: Expected mime type application/octet-stream but got 

text/html. <!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> {msg=SolrCore &#39;search&#39; is not available due to init failure: Error opening new searcher,trace=org.apache.solr.common.SolrException: SolrCore &#39;search&#39; is not available due to init failure: Error opening new searcher
    at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:745)
    ...
    Caused by: org.apache.solr.common.SolrException: Error opening new searcher
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1565)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1677)
    at org.apache.solr.core.SolrCore.&lt;init&gt;(SolrCore.java:845)
    ... 8 more
.
.
.
Caused by: java.nio.file.AccessDeniedException: ....solr&#47;search&#47;data&#47;index&#47;segments_p
    at java.base&#47;sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)

Solution

  • After converting the error stack trace into HTML, I figured out that the permission of file [dspace]/solr/search/data/index/segments_p prevents it to be accessed by the process. The owner of the file was root and I run Tomcat using Eclipse as a non-root user, so I made myself the owner of the file:

    chown myself:myself [dspace]/solr/search/data/index/segments_p
    

    then restarted Tomcat, and reran the command:

    sh [dspace]/bin/dspace index-discovery
    

    It was done perfectly.