solrdataimporthandler

org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler


I am new for solr. I have installed apache tomcat 7.0 on my server and I have solr 3.6.1 on server.

I have solr-home folder set by network guys on my D:\ drive. The folders in that are: bin,etc,logs,multicore,webapps.

In the multicore folder there are: core0,core1,exampledocs,README.txt and solr.xml. In webapps folder I have solr.war file nothing else.

Now I keep one more core folder in multicore folder named ConfigUserTextUpdate which have conf folder in it and restart the tomcat service and I can see the new core on the localhost/solr.

Now I add db-config.xml to the ConfigUserTextUpdate core. Below is the content:

<dataConfig>
<dataSource
type="JdbcDataSource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://<dbname>\<servername>;databaseName=dbname" user="username"
    password="password"/>
<document>
    <entity name="ConfigUserTextUpdate" query="UserTextUpdate_Index">
    </entity>
</document>
</dataConfig>

Upto here everything is fine and all the three cores are shown on localhost/solr. Now in the solrconfig.xml of the core ConfigUserTextUpdate I add the line

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

And it starts giving the error as shown below:

HTTP Status 500 - Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. If you

want solr to continue after configuration errors, change: false in solr.xml ------------------------------------------------------------- org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler' at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:394) at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:419) at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:455) at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:159) at org.apache.solr.core.SolrCore.(SolrCore.java:563) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:480) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:332) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:216) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.DataImportHandler at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.net.FactoryURLClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:378) ... 27 more

I have tried many things as putting the dataimporthandler.jar file in the core folder and other many things given on various sites but still getting the same error. Please help me with these.

Let me know if you need some more information.

Thanks in advance.


Solution

  • you have to edit solrconfig.xml and add the path to the library as well, e.g.:

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

    ..if you still have it in that directory. In the example solrconfigs I found they put it right underneath

    <luceneMatchVersion>LUCENE_40</luceneMatchVersion>