2013-10-02 53 views
6

我似乎有問題,讓Solr的運行起來,我跟着蒞臨指導Solr的RequestHandler初始化失敗

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,因此使用第一個指南來啓動並運行。第二個指南是針對Ubuntu的,在開始安裝JDBC時有一個步驟,我不知道我是否做得對。我想知道這是否可能是問題的一部分。

回答

18

事實證明,我犯了一個愚蠢的錯誤。

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

教程指示我們

example/solr/ 

複製到

/home/solr 

除此之外,由Solr的提供不包含必要的文件來處理dataimports這個特殊的例子。

要解決這個問題:

1)在你的Solr的情況下從你下載的Solr到文件夾創建 'LIB' 文件夾(/家/ Solr的/ lib目錄)

2),複製/dist/solr-dataimporthandler-x.x.x.jarsolr-dataimporthandler-extras-x.x.x.jar。將兩者都粘貼到新創建的lib文件夾中。

如果你還沒有,還要確保你在這個文件夾中有mysql-connector-java.jar。

3)重新啓動服務器。

+0

的文件夾謝謝!它對我來說工作得很好。 – HCarrasko

-1

您需要更改該文件夾的權限:

sudo chmod -R 777 solr 
+0

謝謝,哪個文件夾? –

+0

Solr家。 複製示例/ solr/* – Sudheera