我已经设置了我的solr_4.9.0安装与jetty一起运行,我正在尝试 在solr索引中导入sqlite数据库。我在example \ solr \ collection1 \ conf \ solrconfig.xml中添加了一个额外的请求处理程序:
</requestHandler>
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">db-data-config.xml</str>
</lst>
</requestHandler>
我在example \ solr \ collection1 \ conf \
下创建了一个文件db-data-config.xml <dataConfig>
<dataSource driver="org.sqlite.JDBC"
url="jdbc:sqlite:C:/..../BASE.db"
user=""
password="" />
<document>
<entity name="page" query="SELECT page_id, page_title from page">
<field column="page_id" name="id" />
<field column="page_title" name="name" />
</entity>
</document>
</dataConfig>
我把sqlite-jdbc-3.7.2.jar放在example \ lib下 我使用java -jar start.jar在cmd中运行,我有这个错误
org.apache.solr.common.SolrException: RequestHandler init failure
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:868)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:643)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:556)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:261)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:253)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
caused by: org.apache.solr.common.SolrException: RequestHandler init failure
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:167)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:787)
... 10 more
..................
答案 0 :(得分:2)
解决:只需在solr:\ example \ solr \ lib下创建共享库 并放置JDBC JAR和solr-dataimporthandler - * .jar jars。 在solrconfig.xml中添加以下行:
<lib dir="../lib" />
<lib dir="../lib" regex="solr-dataimporthandler-.*\.jar" />
并且工作正常