Domanda

I have solr-4.5.0 configured to work with tomcat7 and zookeeper 3.3.5 (from debian package) According to many tutorials I have created following Catalina/localhost/solr.xml file

<Context allowlinking="true" crosscontext="true" debug="1" docBase="/var/lib/tomcat7/webapps/solr.war" priviledged="true">
 <Environment name="solr/home" override="true" type="java.lang.String" value="/opt/solr/webapps/solr1" />
</Context>

I have configured solr on 2 machines to work in cloud (using zookeeper to keep configuration). On both machines, when starting tomcat7, I see following error in catalina.out:

11693 [localhost-startStop-1] INFO  org.apache.solr.core.SolrResourceLoader  – No /solr/home in JNDI
....
12529 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer  – Failed to load file /var/lib/tomcat7/solr/collection1/solrconfig.xml
12532 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer  – Unable to create core: collection1
org.apache.solr.common.SolrException: Could not load config file /var/lib/tomcat7/solr/collection1/solrconfig.xml

The interesting thing is that in the beggining of that file I see:

64   [localhost-startStop-1] INFO  org.apache.solr.core.SolrResourceLoader  – Using JNDI solr.home: /opt/solr/webapps/solr1
71   [localhost-startStop-1] INFO  org.apache.solr.core.SolrResourceLoader  – new SolrResourceLoader for directory: '/opt/solr/webapps/solr1/'

Of course I would like to configure solr/home in JNDI, not in solr.war. Any idea what might be wrong?

P.S.: This question is not a duplicate of questions like this: How to set solr/home in linux OS? and this: deploy war in Tomcat The difference is that I am defining solr/home but it seems not to work.

È stato utile?

Soluzione

The issue is related to the fact that there are two different solr deployments on a single tomcat, one of which knows about solr.home, and the other does not.

If there is a row in the logs which says:

org.apache.solr.core.SolrResourceLoader  – Using JNDI solr.home: /opt/solr/webapps/solr1

then it actually means that some solr instance found the solr.home parameter.

But if there are multiple deployments(e.g. for sharding testing), and solr.home is set on per-deployment, and not server-wide (e.g. -Dsolr.solr.home=/some/dir), then some deployments may fail to start.

To avoid such issues(or at least make it more debug-friendly) - one can log each Solr instance to it's own log file.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top