2
votes

I have setup my solr_4.9.0 installation to run with jetty and I am trying to import an sqlite database in the solr index. I add an additional request handler in 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>

i created a file db-data-config.xml under example\solr\collection1\conf\

      <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>

i put sqlite-jdbc-3.7.2.jar under example\lib i run in cmd with java -jar start.jar and i have this error

     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

..................

1

1 Answers

2
votes

Solved:just create shared library under solr : \example\solr\lib and put the JDBC JAR and solr-dataimporthandler-*.jar jars. Add this line in the solrconfig.xml:

     <lib dir="../lib" />
     <lib dir="../lib" regex="solr-dataimporthandler-.*\.jar" />

and it works fine