-->

Sunspot solr NO JSP connection error

2019-07-07 07:03发布

问题:

In my app I had sunspot solr up and running just fine until a few days ago. Now all of a sudden I can't even start my solr in development. Everytime I run rake sunspot:solr:run it throws this error:

:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
Null identity service, trying login service: null
Finding identity service: null

I haven't made any changes to my setup and I've tried the suggestions from this question but nothing seems to work. Does anyone know what that error means and how do I fix it?

Gemfile

gem 'sunspot_solr'
gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master'

sunspot.yml

production:
  solr:
    hostname: websolr_url
    port: 8983
    log_level: WARNING
    path: /solr/production
    # read_timeout: 2
    # open_timeout: 0.5

development:
  solr:
    hostname: localhost
    port: 8983
    log_level: INFO
    path: /solr/development

test:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING
    path: /solr/test

****EDIT****

Here's the errors I'm getting from the /solr admin page. I'm pretty new to solr and don't know how to go about fixing this.

SolrCore Initialization Failures

development: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error opening new searcher

Logs

21:17:53 SEVERE CachingDirectoryFactory Timeout waiting for all directory ref counts to be released

21:17:53 SEVERE CoreContainer Unable to create core: development
org.apache.solr.common.SolrException: Error opening new searcher
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:806)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:619)
    at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1021)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1051)
    at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:634)
    at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.solr.common.SolrException: Error opening new searcher
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1415)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1527)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:781)
    ... 13 more
Caused by: java.io.FileNotFoundException: C:\Sites\LLF\solr\development\data\index\segments_d3 (The system cannot find the file specified)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(Unknown Source)
    at org.apache.lucene.store.FSDirectory$FSIndexInput.<init>(FSDirectory.java:409)
    at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexInput.<init>(SimpleFSDirectory.java:98)
    at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:58)
    at org.apache.lucene.store.NRTCachingDirectory.openInput(NRTCachingDirectory.java:232)
    at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:285)
    at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:56)
    at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:783)
    at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:52)
    at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:87)
    at org.apache.solr.core.StandardIndexReaderFactory.newReader(StandardIndexReaderFactory.java:34)
    at org.apache.solr.search.SolrIndexSearcher.<init>(SolrIndexSearcher.java:124)
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1391)
    ... 15 more

21:17:53 SEVERE CoreContainer null:org.apache.solr.common.SolrException: Unable to create core: development
null:org.apache.solr.common.SolrException: Unable to create core: development

回答1:

This is not caused by sunspot, but by a misconfiguration of your Solr instance. Solr requires JSP support to be able to serve its admin pages (which libraries query to get information about the schema, etc.). If the admin interface isn't available for any reason, this will make libraries barf out with the above message.

Make sure you're able to access /solr (or where you have it installed) on your installation through a regular browser before debugging anything on the client side. For the bundled jetty there's important settings in an .ini file that you'll need to transfer as well. The log for your app container might be able to tell you more (maybe you're missing JSP support in your container, missing .jars, etc.).



回答2:

The cleanest way is to start from cratch:

  • Delete the whole /solr directory
  • re-install
  • start up the solr server to recreate your /solr directory
  • reindex
  • add back any custom configs you had