0
votes

Version list

  • solr 4.2.0
  • ubuntu 12.10
  • tomcat 6
  • sql 5.5.29

i successfully setup solr on my server and can access solr admin page using this link

http://localhost:8080/solr

the problem is on dataimport i see http status 404 error on trying dataimport...

description :The requested resource (/solr/dataimport) is not available.

 http://localhost:8080/solr/dataimport

here is my directory structure

root@web:~/solr-4.2.0/example/solr/collection1/conf# ls

admin-extra.html mapping-FoldToASCII.txt
stopwords.txt admin-extra.menu-bottom.html mapping-ISOLatin1Accent.txt synonyms.txt admin-extra.menu-top.html
protwords.txt update-script.js currency.xml
schema.xml velocity data-config.xml
scripts.conf xslt elevate.xml
solrconfig.xml lang spellings.txt

root@ web:~/solr-4.2.0/example/lib# ls

jetty-continuation-8.1.8.v20121106.jar jetty-server-8.1.8.v20121106.jar jetty-deploy-8.1.8.v20121106.jar
jetty-servlet-8.1.8.v20121106.jar jetty-http-8.1.8.v20121106.jar
jetty-util-8.1.8.v20121106.jar jetty-io-8.1.8.v20121106.jar
jetty-webapp-8.1.8.v20121106.jar jetty-jmx-8.1.8.v20121106.jar
jetty-xml-8.1.8.v20121106.jar jetty-security-8.1.8.v20121106.jar
servlet-api-3.0.jar

root@ web:~/solr-4.2.0/dist# ls -l total 20716 -rw-r--r-- 1 root root 17359734 Mar 7 06:32 solr-4.2.0.war -rw-r--r-- 1 root root 16714 Mar 7 06:31 solr-analysis-extras-4.2.0.jar -rw-r--r-- 1 root root 29896 Mar 7 06:32 solr-cell-4.2.0.jar -rw-r--r-- 1 root root 50435 Mar 7 06:31 solr-clustering-4.2.0.jar -rw-r--r-- 1 root root 2106321 Mar 7 06:32 solr-core-4.2.0.jar -rw-r--r-- 1 root root 217076 Mar 7 06:31 solr-dataimporthandler-4.2.0.jar -rw-r--r-- 1 root root 31134 Mar 7 06:31 solr-dataimporthandler-extras-4.2.0.jar -rw-r--r-- 1 root root 766460 Mar 7 06:32 solr-langid-4.2.0.jar -rw-r--r-- 1 root root 392357 Mar 7 06:32 solr-solrj-4.2.0.jar -rw-r--r-- 1 root root 149825 Mar 7 06:31 solr-test-framework-4.2.0.jar -rw-r--r-- 1 root root 38743 Mar 7 06:32 solr-uima-4.2.0.jar -rw-r--r-- 1 root root 20286 Mar 7 06:32 solr-velocity-4.2.0.jar drwxr-xr-x 2 root root 4096 Jun 20 17:59 solrj-lib drwxr-xr-x 4 root root 4096 Jun 20 17:59 test-framework

root@ web:~/solr-4.2.0/contrib# ls -l total 28 drwxr-xr-x 4 root root 4096 Mar 7 06:33 analysis-extras drwxr-xr-x 3 root root 4096 Jun 20 17:59 clustering drwxr-xr-x 3 root root 4096 Jun 20 17:59 dataimporthandler drwxr-xr-x 3 root root 4096 Jun 20 17:59 extraction drwxr-xr-x 3 root root 4096 Jun 20 17:59 langid drwxr-xr-x 4 root root 4096 Mar 7 06:33 uima drwxr-xr-x 3 root root 4096 Jun 20 17:59 velocity

root@web:~/solr-4.2.0/example/solr# ls -l total 20

-rw-r--r-- 1 root root 2473 Oct 17 2012 README.txt drwxr-xr-x 2 root root 4096 Oct 17 2012 bin drwxr-xr-x 3 root root 4096 Jun 20 17:59 collection1 -rw-r--r-- 1 root root 2222 Jun 25 15:44 solr.xml -rw-r--r-- 1 root root 501 Oct 17 2012 zoo.cfg

In the solarconfig.xml file located in the /solr-4.2.0/example/solr/collection1/conf added dataimport lib path

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

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

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

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

i have tried changing the path to different directories but still the same response..

in the same solarconfig.xml file defined this

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
      <lst name="datasource">
         <str name="driver">com.mysql.jdbc.Driver</str>
         <str name="url">jdbc:mysql://localhost:3306/web</str>
         <str name="user">username</str>
         <str name="password">password</str>
      </lst>
    </lst>
  </requestHandler>

added my own field names in the schema.xml file under other fields names...

<field name="solr_field1" type="long" indexed="true" stored="true" required="true" multiValued="false" />
        <field name="solr_field2" type="long" indexed="true" stored="true" required="true" multiValued="false" />

 <field name="solr_field3" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field4" type="string" indexed="true" stored="true" required="true" multiValued="false" />

<field name="solr_field5" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field6" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field7" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field8" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field9" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field10" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field11" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="solr_field12" type="string" indexed="true" stored="true" required="true" multiValued="false" />

and these afterword these fields as well...

<copyField source="contact_name" dest="text"/>
<copyField source="contact_email" dest="text"/>
<copyField source="business_name" dest="text"/>
<copyField source="city" dest="text"/>
<copyField source="state" dest="text"/>
<copyField source="zip_code" dest="text"/>
<copyField source="phone" dest="text"/>
<copyField source="website" dest="text"/>
<copyField source="address" dest="text"/>
<copyField source="major_division" dest="text"/>

created the data-config.xml file in the same directory and added the following lines

<dataConfig>
 <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver url="jdbc:mysql://localhost:3306/web" user="username" password="password"/>
 <document>
     <entity name="id " query="select * from business">
        <field column="id" name="solr_field1"/>
        <field column="metro_id" name="solr_field2"/>
        <field column="contact_name" name="solr_field3"/>
        <field column="contact_email" name="solr_field4"/>
        <field column="business_name" name="solr_field5"/>
        <field column="city" name="solr_field6"/>
        <field column="state" name="solr_field7"/>
        <field column="zip_code" name="solr_field8"/>
        <field column="phone" name="solr_field9"/>
        <field column="website" name="solr_field10"/>
        <field column="address" name="solr_field11"/>
        <field column="major_division" name="solr_field12"/>
     </entity>
 </document>
</dataConfig>

added sharedLib="../lib" in solr.xml file

<solr persistent="true" sharedLib="../lib">
  <cores adminPath="/admin/cores" defaultCoreName="collection1" host="${host:}" hostPort="${jetty.port:}" hostContext="${hostContext:}" zkClientTimeout="${zkClientTimeout:15000}">
    <core name="collection1" instanceDir="collection1" />
  </cores>
</solr>

any help as to how i can make the solr recognise the dataimport would be much appreciated thankyou ...

1
Are you running jetty or Tomcat ? shouldn't the port be 8983 ??Jayendra
we are using Tomcat. How to check for correct port?Ayaz Alavi

1 Answers

0
votes

I got the same error. The possible solution is

I have added following lines of code in solrconfig.xml file

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

make sure your apache-solr-dataimporthandler-4.0.jar and apache-solr-dataimporthandler-extras-4.0.jar files in the dist folder and it's in correct path.

don't forget to restart the tomcat server.

For more detail check the following Question link.

DIH(Data Import Handler) for xml files is not working in Solr4

Other thing is you are using the Tomcat so your port number is 8080. not 8983.