How to fix IndexNotFoundException: no segments* file found?
Asked Answered
B

3

10

I write my own code to index some data files myself. It was all working. Once I modified the schema.xml file, now i get internal server error that i have no idea how to interpret it.

Internal Server Error

request: http://127.0.0.1:8080/solr/update?wt=javabin&version=2
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:427)
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:249)
    at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)
    at solr.client.SolrClient.index(SolrClient.java:109)
    at solr.client.SolrClient.main(SolrClient.java:26)

Then I look into catalina log file, it's saying that no core created...

   Jun 26, 2012 2:09:21 AM org.apache.solr.core.SolrCore close
INFO: []  CLOSING SolrCore org.apache.solr.core.SolrCore@5675b3ee
Jun 26, 2012 2:09:21 AM org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
    at org.apache.solr.core.SolrCore.close(SolrCore.java:712)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:599)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:483)
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:335)
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:219)
    at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
    at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1585)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

Jun 26, 2012 2:09:21 AM org.apache.solr.core.SolrCore closeSearcher
INFO: [] Closing main searcher on request.
Jun 26, 2012 2:09:21 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:600)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:483)
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:335)
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:219)
    at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
    at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1585)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.NIOFSDirectory@/Users/nan/solr-tomcat/solr/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@11396ef7: files: []
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1104)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:585)
    ... 23 more
Caused by: org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.NIOFSDirectory@/Users/nan/solr-tomcat/solr/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@11396ef7: files: []
    at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:667)
    at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:72)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:375)
    at org.apache.solr.core.StandardIndexReaderFactory.newReader(StandardIndexReaderFactory.java:38)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1093)
    ... 24 more

Updated catalina log file above...yes i removed the index data since i thought i am going to create new index...and i did this earlier today but i didnt see this kinda error until now...how should i fix this? :(

Thanks a lot!!! (^infinitive times)

Banyan answered 26/6, 2012 at 9:42 Comment(5)
There should be something more in your catalina log file, above what you posted. Can you post that fragment instead of the "No cores were created" one please?Remount
thanks for offering help, javanna :). I just updated the log file in the question. The thing is i removed index file since i will re-run the index through my code...how should i fix this now? thanks!Banyan
@Remount i fixed this by copying some segment data (segments.gen and segments_2) from spellchecker directory to index directory..Banyan
possible duplicate of How to recover from Solr deleted index files?Birthplace
For me, this happened when I made a tarball of the /var/solr folder of a running Solr instance, while it was modifying its own files. This caused the tarball to be inconsistent, so when restoring it to another instance, some files were missing, and I got this error on the new instance. The solution was to stop the original instance before copying the files.Nitaniter
R
22

As you can see from your log file Solr/Lucene can't find the segments file within the data directory.

If you remove the data directory, Solr will recreate a brand new index (empty, of course)automatically on startup. From the error it seems that your data directory is there, but with some file missing. Since I understood that you are willing to reindex everything, you can fix the error just deleting your index directory and then reindex.

Remount answered 26/6, 2012 at 10:44 Comment(2)
i run into a strange solr exception today after i restart tomcat. basically my solr instance is no longer working. i am too new to this thing and have no idea on how to fix it. can you please help me take a look again? stackoverflow.com/questions/11234132/strange-solr-exceptionBanyan
I'd like to add that removing the files within the data/ directory might not be enough (what I tried at first). You need to remove the directory itself.Herzberg
B
2

Exception IndexNotFoundException signals that no index was found in the Directory. Possibly because the directory is empty, however can also indicate an index corruption.

So you should:

  1. Delete the index directory or restore data from backups.
  2. Restart the server (or at least the reload the config).
Birthplace answered 8/4, 2015 at 14:1 Comment(0)
P
1

I experienced this error because there were no documents to search yet (which happens on my workstation).

Triggering the creation of a document will fix the issue in this case.

Phenobarbital answered 9/8, 2021 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.