2

I am trying to do the full db import using below URL

    `127.0.0.1:8983/solr/dataimport?command=full-import`

I installed solr and trying to configure it. I changed few files and putted details (file names and added code is described below). But when I am trying to import the table data into solr json format it is showing below error:

    HTTP ERROR 404

    Problem accessing /solr/dataimport. Reason:

    Not Found
        Powered by Jetty://

Can anyone let me know what the actual problem is? Or did I misconfigure Sorl?


My data-config.xml file have below code:

<dataConfig>
  <dataSource type="JdbcDataSource" 
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost/sq_dbLoveOffers" 
              user="pksqueak" 
              password="passwd"/>
  <document>
    <entity name="id" 
            query="select sq_prom_id, sq_prom_name, sq_prom_description, sq_latitude, sq_longitude from sq_offers">
    </entity>
  </document>
</dataConfig>

I added below code into Solrconfig.xml:

<lib dir="../../../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
<lib dir="../../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />

and

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

I added below code in schema.xmal FILE:

<fields>
    <field name="sq_prom_id" type="string" indexed="true" stored="true" required="true" />
    <field name="sq_prom_name" type="string" indexed="true" stored="true" />
    <field name="sq_prom_description" type="string" indexed="true" stored="true" />
    <field name="sq_latitude" type="string" indexed="true" stored="true" />
    <field name="sq_longitude" type="string" indexed="true" stored="true" />
</fields>
Philipp M
  • 1,877
  • 7
  • 27
  • 38
Prafulkr
  • 81
  • 1
  • 8
  • Do you see any messages or errors in Solr's logs or in those of your server (jetty/tomcat)? – cheffe Nov 06 '13 at 16:28

3 Answers3

2

In case the core you address is not your default core, your request is lacking the core's name in the URL. You should request should be like this

127.0.0.1:8983/solr/<core-name>/dataimport?command=full-import

There you need to replace the <core-name> with the actual name of your core, as configured in your solr.xml.

cheffe
  • 9,345
  • 2
  • 46
  • 57
  • Even I am adding the core name, it is showing same error (In this case my core is "collection1"). URL is: http://localhost:8983/solr/#/collection1/dataimport/dataimport?command=full-import – Prafulkr Nov 07 '13 at 09:57
  • @Praful Leave the `#` away. – cheffe Nov 07 '13 at 10:07
  • No luck cheffe. I am getting below error: HTTP ERROR 404 Problem accessing /solr/collection1dataimport. Reason: Not Found But if check the error here "collection1dataimport" has no separator (common slash /) ? – Prafulkr Nov 07 '13 at 10:20
  • @Praful of course you do need that slash and you do need that `dataimport` just **once** like this: `http://localhost:8983/solr/collection1/dataimport?command=full-import` just as written in the answer ... – cheffe Nov 07 '13 at 10:37
  • thanks cheffe for your kind help but it doesn't solve my problem. Anyway Can you Please let me know that "data-config.xml" "Solrconfig.xml" and "schema.xml" file content is correct or not. (I changed these file in my core folder) – Prafulkr Nov 07 '13 at 10:50
  • @Praful If that URL is not working, check your log files, what do they say? About the correctness I cannot tell, if they are OK as a whole, as they are not complete, but excerpts. As far as I can see they are ok. – cheffe Nov 07 '13 at 11:02
2

I used below command to run sorl server for DIH.

java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar

and I did the full import using below URL, it solved my problem.

http://127.0.0.1:8983/solr/db/dataimport?command=full-import
Prafulkr
  • 81
  • 1
  • 8
2

I have a functioning Data Import Handler and you can compare configs with me if necessary http://amac4.blogspot.co.uk/2013/08/configuring-solr-4-data-import-handler.html

Allan Macmillan
  • 1,481
  • 3
  • 18
  • 30