升级到solr 6.1,异常ClassNotFoundException:solr.admin.AdminHandlers

时间:2016-07-01 15:32:18

标签: solr

我注意到从solr 5.3更改为6.1后,我创建EmbeddedSolrServer的代码(见下文)将导致以下异常:

String solrHome = prop.getProperty(PROPERTY_FIELD_SOLR_HOME);
String solrCore = "anotherCore";
CoreContainer solrCores = new EmbeddedSolrServer(
            Paths.get(solrHome), solrCore
    ).getCoreContainer();
EmbeddedSolrServer mycore=
            new EmbeddedSolrServer(solrCores.getCore("mycore"));

最后一行适用于solr 5.3,但使用6.1时,会生成以下异常。有什么想法吗?

    Exception in thread "main" org.apache.solr.common.SolrException: SolrCore     'mycore' is not available due to init failure: Error loading class     'solr.admin.AdminHandlers'
        at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1066)
        at uk.ac.ntu.sac.sense.SenseProperty.getClassIndex(SenseProperty.java:91)
        at uk.ac.ntu.sac.sense.kb.indexer.IndexMaster.<init>(IndexMaster.java:31)
        at uk.ac.ntu.sac.sense.test.TestIndexer.main(TestIndexer.java:14)
Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.admin.AdminHandlers'
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:773)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:647)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:812)
    at org.apache.solr.core.CoreContainer.lambda$load$0(CoreContainer.java:466)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$22(ExecutorUtil.java:229)
    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: Error loading class 'solr.admin.AdminHandlers'
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:536)
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:467)
    at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:570)
    at org.apache.solr.core.PluginBag.createPlugin(PluginBag.java:125)
    at org.apache.solr.core.PluginBag.init(PluginBag.java:225)
    at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:130)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:732)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: solr.admin.AdminHandlers
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    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:520)
    ... 14 more

1 个答案:

答案 0 :(得分:15)

我有同样的问题,但我想是因为他们从6.1(或5.3之后的某个时间)删除了这个类。从有问题的核心中的solrconfig.xml中删除元素对我有用,并且应该也为你做这个技巧。

<!-- find this line in your solrconfig.xml and comment/remove it -->
<requestHandler name="/admin/"
                class="solr.admin.AdminHandlers"/>