java - 在 solr 的类路径中找不到资源 'solrconfig.xml'

标签 java xml apache solr

问题

回应

    <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 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
  • 当我运行这个命令时

    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 15948 2276 pts/14 S+ 16:45 0:00 grep --color=auto java

  • 它正常工作突然抛出错误。

最佳答案

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

    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

关于java - 在 solr 的类路径中找不到资源 'solrconfig.xml',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35407796/

相关文章:

java - 使用 Java 客户端连接到外部 HTTPS Elasticsearch

java - 使用 InSequence 注释时出现 arquillian UnsupportedOperationException

php - 摆脱 CodeIgniter URL 中的 Index.php

PHP require_once 包括文件但变量未在新的 httpd/php/mysql CentOS 安装上使用

java - Apache Tomcat 7 显示空白页面 Mac OSX 10.8

java - IntelliJ IDEA : use different indentation for continuation of method call versus other continuation

java - 使用JDBC连接mysql远程数据库?

java - applicationContext.xml 与 sessionFactory bean 的配置冲突

javascript - 将 XML 文件中的数据添加到 JS 对象数组中

Android-键盘启动时如何自动滚动