Error creating core [DataimportExample]: Error loading class ‘org.apache.solr.handler.dataimport.DataImportHandler’
org.apache.solr.common.SolrException: Error loading class ‘org.apache.solr.handler.dataimport.DataImportHandler’

when we index document from database and configure dataimport request handler at that time may people faced this issue.The main reason for this issue is missing library configuration in solrconfig.xml file.

Let’s have a look of full stack trace of this error.

Error creating core [DataimportExample_2]: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler'
org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler'
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:952)
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:816)
  at org.apache.solr.core.CoreContainer.create(CoreContainer.java:890)
  at org.apache.solr.core.CoreContainer.create(CoreContainer.java:827)
  at org.apache.solr.handler.admin.CoreAdminOperation.lambda$static$0(CoreAdminOperation.java:88)
  at org.apache.solr.handler.admin.CoreAdminOperation.execute(CoreAdminOperation.java:377)
  at org.apache.solr.handler.admin.CoreAdminHandler$CallInfo.call(CoreAdminHandler.java:379)
  at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:165)
  at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:166)
  at org.apache.solr.servlet.HttpSolrCall.handleAdminRequest(HttpSolrCall.java:664)
  at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:445)
  at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
  at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:296)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
  at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
  at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
  at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
  at org.eclipse.jetty.server.Server.handle(Server.java:534)
  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
  at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
  at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
  at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
  at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
  at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
  at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
  at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
  at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler'
  at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:556)
  at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:487)
  at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:739)
  at org.apache.solr.core.PluginBag.createPlugin(PluginBag.java:126)
  at org.apache.solr.core.PluginBag.init(PluginBag.java:226)
  at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:130)
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:911)
  ... 37 more
Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.DataImportHandler
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:814)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:348)
  at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:540)

 

Solutions:

We can solve above error in two way.

Solution 1: Add dataimport libraries to classpath

First solution is to add below lines in solrconfig.xml file and try to create new core or reload existing core.

<lib dir="${solr.install.dir:../../../..}/contrib/dataimporthandler-extrass/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandlers-\d.*\.jar" />

Solution 2: Add dataimport libraries to core lib folder

Second one is to copy solr-dataimporthandlers-{SOLR_VERSION}.jar file in solr core lib folder.

Refer Solr index document from database,DataimportHandler for more details.

 

Was this post helpful?
Let us know, if you liked the post. Only in this way, we can improve us.
Yes
No

Leave a Reply

Your email address will not be published. Required fields are marked *