I was running a Solr on Ubuntu 12.04 Tomcat6; we upgraded to 16.04 and Tomcat8, and the Solr stopped reading some indices. I believe the only indices that were affected are ones where the configuration directory is softlinked. Some Googling later, I found that allowLinking
attribute was moved. This was my old config:
<!-- /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>
I rewrote to:
<!-- /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>
and even tried in the global context:
<!-- /etc/tomcat8/context.xml -->
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<Resources allowLinking="true"/>
</Context>
but I couldn't get Solr to load those cores. The error in /var/log/tomcat8/catalina.out
is as follows:
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
(午後 means "pm", "重大" is "serious")
Stupid problem, stupid answer.
Tomcat 6 was running under the group tomcat6
. Tomcat 8 runs as tomcat8
.
My files were -rw-rw---- amadan:tomcat6
.
Solution: chgrp -R tomcat8 /disks/disk00/solr/
.