6

我似乎在启动和运行 solr 时遇到问题,我按照此处的指南进行操作

http://andres.jaimes.net/878/setup-lucene-solr-centos-tomcat/

一切顺利,但现在我正在尝试从 mysql 导入数据。为此,我一直在遵循本指南

http://www.wheelsandcogs.co.uk/2011/01/13/solr-tomcat-mysql-ubuntu/

当我将它添加到我的 solrconfig.xml 时出现错误

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">data-config.xml</str>
  </lst>
</requestHandler>

这是我得到的错误。如果我删除它,solr 运行良好,但我当然不能从 mysql 导入。

HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure:
RequestHandler init failure,trace=org.apache.solr.common.SolrException: SolrCore 
'collection1' is not available due to init failure: RequestHandler init failure at 
org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1212) at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:248) at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:155) at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
a:235) at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java
:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at 
java.lang.Thread.run(Thread.java:724) Caused by: org.apache.solr.common.SolrException: 
RequestHandler init failure at org.apache.solr.core.SolrCore.<init>(SolrCore.java:821) at 
org.apache.solr.core.SolrCore.<init>(SolrCore.java:618) at 
org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:949) at 
org.apache.solr.core.CoreContainer.create(CoreContainer.java:984) at 
org.apache.solr.core.CoreContainer$2.call(CoreContainer.java:597) at 
org.apache.solr.core.CoreContainer$2.call(CoreContainer.java:592) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at 
java.util.concurrent.FutureTask.run(FutureTask.java:166) at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at 
java.util.concurrent.FutureTask.run(FutureTask.java:166) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ... 1 more 
Caused by: org.apache.solr.common.SolrException: RequestHandler init failure at 
org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:168) at 
org.apache.solr.core.SolrCore.<init>(SolrCore.java:758) ... 13 more Caused by: 
org.apache.solr.common.SolrException: Error loading class 
'org.apache.solr.handler.dataimport.DataImportHandler' at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:464) at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:396) at 
org.apache.solr.core.SolrCore.createInstance(SolrCore.java:518) at 
org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:592) at 
org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:154) ... 
14 more Caused by: java.lang.ClassNotFoundException: 
org.apache.solr.handler.dataimport.DataImportHandler at 
java.net.URLClassLoader$1.run(URLClassLoader.java:366) at 
java.net.URLClassLoader$1.run(URLClassLoader.java:355) at 
java.security.AccessController.doPrivileged(Native Method) at 
java.net.URLClassLoader.findClass(URLClassLoader.java:354) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at 
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native 
Method) at java.lang.Class.forName(Class.java:270) at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:448) ... 18 more 
,code=500}

我正在运行 Centos,因此使用第一个指南来启动和运行 solr。第二个指南适用于 Ubuntu,在安装 JDBC 的开头附近有一个步骤,我不确定我是否做对了。我想知道这是否可能是问题的一部分。

4

2 回答 2

18

事实证明我犯了一个愚蠢的错误。

上面的教程http://andres.jaimes.net/878/setup-lucene-solr-centos-tomcat/

指示我们复制

example/solr/ 

/home/solr

除此之外,solr 提供的这个特定示例不包含处理数据导入所需的文件。

要解决这个问题:

1) 在您的 solr 实例 (/home/solr/lib) 中创建一个“lib”文件夹

2) 从您将 solr 下载到的文件夹中,复制/dist/solr-dataimporthandler-x.x.x.jarsolr-dataimporthandler-extras-x.x.x.jar. 将两者粘贴到新创建的 lib 文件夹中。

如果还没有的话,还要确保在这个文件夹中有 mysql-connector-java.jar。

3) 重启服务器。

于 2013-11-20T15:57:32.047 回答
-1

您需要更改文件夹的权限:

sudo chmod -R 777 solr
于 2013-11-18T16:19:48.300 回答