Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upgrade to solr 6.1, exception ClassNotFoundException: solr.admin.AdminHandlers

Tags:

solr

I notice that after changing from solr 5.3 to 6.1, my code that creates an EmbeddedSolrServer (see below) will cause the following exception:

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"));

The last line works ok with solr 5.3, but with 6.1, the following exception is generated. Any ideas please?

    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
like image 328
Ziqi Avatar asked Jul 01 '16 15:07

Ziqi


1 Answers

I'm having the same issue, but I imagine its because they removed that class from 6.1 (or sometime after 5.3). Removing the element from solrconfig.xml in the problematic core worked for me and should hopefully do the trick for you as well.

<!-- find this line in your solrconfig.xml and comment/remove it -->
<requestHandler name="/admin/"
                class="solr.admin.AdminHandlers"/>
like image 197
mc_coder Avatar answered Sep 29 '22 03:09

mc_coder