3

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.

Community
  • 1
  • 1
running.t
  • 5,329
  • 3
  • 32
  • 50
  • 2
    Are there by any chance two different solr instances on the same tomcat? (e.g. webapps/solr.war and webapps/solr1/ <- where solr1 is extracter solr.war)? – rchukh Nov 03 '13 at 00:25
  • Also, can you show the next few lines after `71 [localhost-startStop-1] INFO org.apache.solr.core.SolrResourceLoader – new SolrResourceLoader for directory: '/opt/solr/webapps/solr1/'`? – rchukh Nov 03 '13 at 00:26
  • 3
    And one more thing - according to [tomcat 7.0 documentation](http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Defining_a_context)some of the `Context` parameters should not be totally lowercase (e.g. allowlinking => allowLinking, crosscontext => crossContext), priviledged has a typo (should be privileged), and there no such option as debug. – rchukh Nov 03 '13 at 00:29
  • @rchukh: [That](http://stackoverflow.com/questions/19718127/no-solr-home-in-jndi-althought-its-set-in-catalina-localhost-solr-xml#comment29345681_19718127) was the problem. I have created a backup dir in /var/lib/tomcat7/webaps/solr.backup And no solr/home was raised while: "Deploying web application directory /var/lib/tomcat7/webapps/solr.backup" – running.t Nov 05 '13 at 22:05
  • 2
    #rchuk: you may want to write this comment as an answer to get bounty. – running.t Nov 05 '13 at 22:28

1 Answers1

3

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.

rchukh
  • 2,877
  • 2
  • 21
  • 25