solr之Tomcat6升级到Tomcat8后报错: Could not load config for solrconfig. xml

txw1958 阅读:104 2025-05-04 20:05:19 评论:0

我在 Ubuntu 12.04 Tomcat6 上运行 Solr;我们升级到 16.04 和 Tomcat8,Solr 停止读取一些索引。我相信唯一受影响的索引是配置目录被软链接(soft link)的索引。后来谷歌搜索了一下,我发现 allowLinking 属性被移动了。这是我的旧配置:

<!-- /etc/tomcat6/Catalina/localhost/solr.xml --> 
<Context path="/solr" docBase="/usr/share/solr" 
    debug="0" privileged="true" allowLinking="true" crossContext="true"> 
  <Environment name="solr/home" type="java.lang.String" value="/usr/share/solr" override="true" /> 
</Context> 

我改写为:

<!-- /etc/tomcat8/Catalina/localhost/solr.xml --> 
<Context path="/solr" docBase="/usr/share/solr"                                    
    privileged="true" crossContext="true">                                          
  <Resources allowLinking="true" />       
  <Environment name="solr/home" type="java.lang.String" value="/usr/share/solr" override="true" /> 
</Context> 

甚至在全局范围内尝试过:

<!-- /etc/tomcat8/context.xml --> 
<Context> 
  <WatchedResource>WEB-INF/web.xml</WatchedResource> 
  <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> 
  <Resources allowLinking="true"/> 
</Context> 

但我无法让 Solr 加载这些内核。 /var/log/tomcat8/catalina.out错误如下:

3 27, 2017 2:22:33 午後 org.apache.solr.core.CoreContainer recordAndThrow 
重大: Unable to create core: blacklight-core 
org.apache.solr.common.SolrException: Could not load config for solrconfig.xml 
        at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:973) 
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1033) 
        at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629) 
        at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:624) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
        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: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or '/disks/disk00/solr/library/blacklight-core/conf/', cwd=/var/lib/tomcat8 
        at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:316) 
        at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:281) 
        at org.apache.solr.core.Config.<init>(Config.java:103) 
        at org.apache.solr.core.Config.<init>(Config.java:73) 
        at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:117) 
        at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:971) 
        ... 9 more 

(午后表示“下午”,“重大”表示“严重”)

请您参考如下方法:

愚蠢的问题,愚蠢的答案。

Tomcat 6 在 tomcat6 组下运行。 Tomcat 8 作为 tomcat8 运行。

我的文件是 -rw-rw---- amadan:tomcat6

解决方案:chgrp -R tomcat8/disks/disk00/solr/


标签:Tomcat
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号