ClassNotFoundException: dataimport.DataImportHandler

exception, import, java, mysql, solr

Solution

In your solr conf check if you have included the DIH jar, if you haven't then you should add something like below

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

Problem

Hi I'm using the Solr 4 beta, and I'm not a Java programmer. And I'm configuring the DataImportHandler withing the example folder for my MySQL DB. Problem is, when I'm starting the server with: ``` java -jar start.jar ``` My solrconfig.xml has this: ``` <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> <lst name="defaults"> <str name="config">data-config.xml</str> </lst> </requestHandler> ``` From the other thread the advise was to copy apache-solr-solrj-4.0.jar to the lib/ directory, which I did. One only difference is that in the current Solr release, the filename is: apache-solr-solrj-4.0.0-BETA.jar, but I tried to copy it with different names. Also, I added to the solrconfig.xml this line so that SolrJ would be loaded: ``` <lib dir="/dist/" regex="apache-solr-solrj-*\.jar" /> ``` Nevertheless, I'm still getting the exception: ``` SEVERE: null:org.apache.solr.common.SolrException: RequestHandler init failure at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:168) . .... Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.DataImportHandler ```

Original source