本文介绍了在solr的类路径中找不到资源'solrconfig.xml'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

  • i cannot access solr admin page.
  • when i run url on localsystem:http://localhost:8983/solr/admin/cores?action=CREATE&name=new_core&configSet=basic_configs

响应

    <response>
    <lst name="responseHeader">
    <int name="status">400</int>
    <int name="QTime">17</int>
    </lst>
    <lst name="error">
    <str name="msg">
    Error CREATEing SolrCore 'new_core': Unable to create core: new_core Caused by: Can't find resource 'solrconfig.xml' in classpath or '/var/lib/tomcat7/solr/new_core/conf'
    </str>
    <int name="code">400</int>
    </lst>
    </response>

  • 我引用了以下链接: https://wiki.apache.org/solr/CoreAdmin

    solr.xml代码

    solr.xml code

    <solr persistent="false">
        <cores adminPath="/admin/cores">
            <core name="afeef" instanceDir="afeef" />
        </cores>
    </solr>
    

  • 错误:

      SolrCore Initialization Failures
        afeef: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load config file /var/lib/tomcat7/solr/afeef/solrconfig.xml
        coreX: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load config file /var/lib/tomcat7/solr/path_to_instance_directory/config_file_name.xml
        new_core: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load config file /var/lib/tomcat7/solr/new_core/solrconfig.xml
    

    • 当我运行此cmd时

      • when i run this cmd

        ps aux | grep java

        ps aux|grep java

        tomcat7 23192 0.7 2.0 2579744 161852吗? Sl 16:22 0:11/usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file =/var/lib/tomcat7/conf/logging.properties -Djava.util.logging .manager = org.apache.juli.ClassLoaderLogManager -Djava.awt.headless = true -Xmx128m -XX:+ UseConcMarkSweepGC -Djava.endorsed.dirs =/usr/share/tomcat7/endorsed -classpath/usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base =/var/lib/tomcat7 -Dcatalina.home =/usr/share/tomcat7 -Djava.io.tmpdir =/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap启动mohd 24047 0.0 0.0 0.0 15948 2276 pts/14 S + 16:45 0:00 grep --color = auto java

        tomcat7 23192 0.7 2.0 2579744 161852 ? Sl 16:22 0:11 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap startmohd 24047 0.0 0.0 15948 2276 pts/14 S+ 16:45 0:00 grep --color=auto java

        突然突然工作正常,并抛出错误.

        it was working properly suddenly it throws error .

        推荐答案

        正如您在链接中引用的Wiki中所提到的那样,http请求中的instanceDir参数是必需参数.配置,架构和dataDir参数是可选的. (默认情况是在instanceDir中查找solrconfig.xml/schema.xml.默认情况下,查找dataDir的位置取决于solrconfig.xml.)例子创建请求

        As it is mentionned in the wiki that you referenced in the link , instanceDir parameter in the http request is a required parameter. config, schema & dataDir parameters are optional. (Default is to look for solrconfig.xml/schema.xml inside instanceDir. Default place to look for dataDir depends on solrconfig.xml.)Example ofCreate Request

            http://localhost:8983/solr/admin/cores?action=CREATE&name=coreX&instanceDir=path_to_instance_directory&
        config=config_file_name.xml&schema=schema_file_name.xml&dataDir=data
        

        这篇关于在solr的类路径中找不到资源'solrconfig.xml'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:02