Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
545 views
in Technique[技术] by (71.8m points)

tomcat - Solr RequestHandler init failure

I seem to be having problems getting solr up and running, I followed the guide here

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

All went well, but now I'm trying to import data from mysql. To do this I have been following this guide

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

The error comes when I add this to my solrconfig.xml

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

This is the error I get. If I remove this, solr runs fine but of course I cannot import from 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}

I am running Centos, hence using the first guide to get solr up and running. The 2nd guide is for Ubuntu, there is a step near the beginning about installing the JDBC, I am not sure if I did it right.. I'm wondering if this may be part of the problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It turns out I made a stupid mistake.

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

Instructs us to copy

example/solr/ 

to

/home/solr

Except, this particular example provided by solr does not contain the necessary files to handle dataimports.

To fix this:

1) Create a 'lib' folder in your solr instance (/home/solr/lib)

2) From the folder where you downloaded solr to, copy /dist/solr-dataimporthandler-x.x.x.jar and solr-dataimporthandler-extras-x.x.x.jar. Paste both into your newly created lib folder.

Also ensure you have mysql-connector-java.jar in this folder if you haven't already.

3) Restart the server.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...