Solr DataImportHandler not found

筅森魡賤 提交于 2019-11-30 11:10:50

I've been looking at this problem for a bit on my own, using solr 4.1 and tomcat. I wasn't able to include the library I needed with <lib dir="../../dist/" regex="solr-dataimporthandler-.*\.jar" /> -->, which I figured had to be correct because from the directory that I had the solrconfig.xml in, it was two directories up and one down to dist. It wasn't until I temporarily subbed in the direct path (for me, /opt/solr/dist) that I realized that the problem was that I was starting from the wrong directory. It turns out that what I needed was:

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

So, if you're having trouble with including this, check that you're starting from the directory that contains your conf directory, and not the conf directory itself.

The jar you are looking for (at least in 3.5) is under the ./dists folder

It seems that for several versions of Solr including 4.3, the dataimport handler jar is not included in the final war file when you build from source.

There is a very simple fix to this by modifying the file /solr/webapp/build.xml.

  1. Open that file and find the "dist" target.
  2. Find this section of the "dist" target:

    <lib dir="${dist}" excludes="${exclude.from.war},${common.classpath.excludes}">

  3. Add this item to the list of includes in that section:

    <include name="apache-solr-dataimporthandler-${version}.jar" />

Save and exit.

Now, when you build, do the following:

  • ant dist-contrib
  • ant dist

To verify that the dataimporthandler jars are in your WAR file, unpack it, and look for it among the jars in the WEB-INF/lib directory.

Some variation of this will probably work for earlier versions too.

As far as you are telling us, your jar file name does not match the supplied regexp:

With the given configuration:

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

The file:

dataimporthandler.jar

Does not match the regexp, while it has to, as shown in the sample configuration file for Solr

Probably start by just specifying:

<lib dir="../../dist/"/>

i put solr jars under WEB-INF/lib

I solved this problem by building dataimporthandler jar from the solr source. For 3.1, dataimporthandler is not included in apache-solr-core-3.1.0.jar . I couldn't find the jar file for dataimporthandler, so I built it from the source and put it in my solr lib directory

I am using Solr 4.0 with a Glassfish 3.1.2 container and I solved the problem by opening the solr war itself, manually just adding the jar files inside, and redeploying glassfish.

Make sure you have following three required fields correct.

1) A entry for dataimport handler in solr-conf.xml

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

2) Your Solr war file is aware of solr-home folder , and hence the libraries included in solr-home. If solr-home is added explicitly.

To make your solr.war aware of solr-home folder deploy the solr.war at server.

Go to apache-tomcat-6.0.36/webapps/solr/WEB-INF and open web.xml in any text editor.

Now search for the entry showing below

<!-- <env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value> /Path/To/My/solr/Home/solr/</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry> -->

replace value to the solr-home folder in your case. This will make solr, point solr-home folder hence lib folder inside it.

3) Add your new libraries location to /home/javaguys/solr-home/collection1/conf/solr-config.xml. just under tag like .

This will solve your problem i hope, for more information please check out this solution here.

Had this problem twice, on Windows Tomcat, and Ubuntu Tomcat.
SOLR 4.3, and Tomcat 7

Make sure that the file below is in the SOLR_Home /lib folder
solr-dataimporthandler-4.3.0.jar

As mentioned above you also need the reference in the config file. Adjust the path as needed.

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

I might have some paths messed up, but that is how I got it to work.

You need to add below code in your solrconfig.xml file under the config tag.
Note: Please change the version of jar files accordingly.

<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="mysql-connector-java-5.1.18-bin.jar" />

For more information you can refer connecting-solr-to-database .

user2098849

The version is 4.3.1, I copied the dataimporthandler jar to /lib but it didn't work. I added this to conf/solrconfig.xml to fix this problem.

<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!