我正在尝试在运行AMI的EC2实例上设置我的应用程序的开发版本(RoR 4.0,Sunspot)。我有gem install sunspot_solr
然后bundle exec rake sunspot:solr:start
太阳黑子似乎正常开始。我也可以通过网络界面访问它。然后出现问题,每当我尝试添加新对象时,就会出现500内部服务器错误:
RSolr::Error::Http - 500 Internal Server Error Error: {'responseHeader'=>{'status'=>500,'QTime'=>3},'error'=>{'msg'=>'no segments* file found in NRTCachingDirectory(org.apache.lucene.store.MMapDirectory@/home/ec2-user/rails-projects/local-development/solr/development/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@6b01af7; maxCacheMB=48.0 maxMergeSizeMB=4.0): files: [write.lock]','trace'=>'org.apache.lucene.index.IndexNotFoundException: no segments* file found in NRTCachingDirectory(org.apache.lucene.store.MMapDirectory@/home/ec2-user/rails-projects/local-development/solr/development/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@6b01af7; maxCacheMB=48.0 maxMergeSizeMB=4.0): files: [write.lock] at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:741) at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:630) at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:343) at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:673) at org.apache.solr.update.SolrIndexWriter.<init>(SolrIndexWriter.java:77) at org.apache.solr.update.SolrIndexWriter.create(SolrIndexWriter.java:64) at org.apache.solr.update.DefaultSolrCoreState.createMainIndexWriter(DefaultSolrCoreState.java:192) at org.apache.solr.update.DefaultSolrCoreState.getIndexWriter(DefaultSolrCoreState.java:106) at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:153) at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69) Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">Post 4</field><field name=\"type\">Post</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">Post</field><field name=\"subject_text\"/><field name=\"subject_text\">Van Gogh in London</field><field name=\"description_text\"/><field name=\"description_text\">Testing Experience for Van Gogh. \n \nVincent Willem van Gogh was a post-Impressionist painter of Dutch origin whose work—notable for its rough beauty, emotional honesty, and bold color—had a far-reaching influence on 20th-century art. Wikipedia \nBorn: March 30, 1853, Zundert, Netherlands \nDied: July 29, 1890, Auvers-sur-Oise, France \nPeriod: Post-Impressionism \nSiblings: Theo van Gogh, Wil van Gogh, Vincent Van Gogh, more \nParents: Anna Carbentus van Gogh, Theodorus van Gogh</field><field name=\"tagline_text\"/><field name=\"tagline_text\"/></doc></add>" Backtrace: /usr/local/rvm/gems/ruby-2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in `adapt_response' /usr/local/rvm/gems/ruby-2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:190:in `execute' /usr/local/rvm/gems/ruby-2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:176:in `send_and_receive' /usr/local/rvm/gems/ruby-2.1.0/gems/sunspot_rails-2.1.1/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation' /usr/local/rvm/gems/ruby-2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument' /usr/local/rvm/gems/ruby-2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /usr/local/rvm/gems/ruby-2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument' /usr/local/rvm/gems/ruby-2.1.0/gems/sunspot_rails-2.1.1/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation' (eval):2:in `post' /usr/local/rvm/gems/ruby-2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:82:in `update' /usr/local/rvm/gems/ruby-2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:102:in `add'
然后我尝试重新索引太阳黑子以进行故障排除。它返回一个类似的错误:
Error - RSolr::Error::Http - 500 Internal Server Error - retrying...
Error - RSolr::Error::Http - 500 Internal Server Error - ignoring...
Error - RSolr::Error::Http - 500 Internal Server Error - retrying...
Error - RSolr::Error::Http - 500 Internal Server Error - ignoring...
从网络界面看,它似乎与Dataimport Handler相关?当我点击我的核心DIH时,它显示:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">500</int><int name="QTime">2</int></lst><lst name="error"><str name="trace">java.lang.NullPointerException
at org.apache.solr.handler.admin.ShowFileRequestHandler.showFromFileSystem(ShowFileRequestHandler.java:212)
at org.apache.solr.handler.admin.ShowFileRequestHandler.handleRequestBody(ShowFileRequestHandler.java:122)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1797)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:637)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:343)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:744)
</str><int name="code">500</int></lst>
</response>
我刚刚关注太阳黑子网站上的快速入门指南,它在本地计算机上工作得很好。我设置它的方式与EC2完全相同,但它不起作用。因此,我认为它与DIH无关(因为我还没有在本地机器上定义DIH配置)。
我一直在寻找解决方案两天但没有运气......任何想法都会非常感激!
谢谢