1. 程式人生 > >Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimportHandler

Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimportHandler

錯誤描述:配置solr伺服器時可能會報這個錯

4351 [coreLoadExecutor-5-thread-1] ERROR org.apache.solr.core.CoreContainer  – Error creating core [collection1]: RequestHandler init failure
org.apache.solr.common.SolrException: RequestHandler init failure
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:881)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:654)
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:491)
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:255)
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: RequestHandler init failure
        at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:172)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:800)
        ... 8 more
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:490)
        at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:421)
        at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:551)
        at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:624)
        at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:158)
        ... 9 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:474)

錯誤原因:出現這個異常,是找不到solr-dataimporthandler-4.4.0.jar這個jar包,預設不在solr.war包裡,在下載包的dist目錄下。

錯誤解決:配置位置有問題,直接將 solr-dataimporthandler-4.3.0.jar 複製到 solr\WEB-INF\lib ,重啟Tomcat即可