Running Solr on Debian with Tomcat
02 Dec 2007SOLR, "Searching On Lucene with Replication" which started out life at CNET, before it was released to the open source community comes with a solid example configuration using the Jetty embeded servlet container.
Getting SOLR running on Debian GNU/Linux with Tomcat in production environments can be a tad tricker. If you just unpacked the dist/solr.war into your webapps directory you probably saw some non descriptive error like: "FAIL - Application at context path /apache-solr-1.2.0 could not be started", or something like the following in your localhost log:
SEVERE: Exception starting filter SolrRequestFilter java.lang.NoClassDefFoundError: Could not initialize class org.apache.solr.core.SolrConfig at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:74)
There are two things that can really bite you
1) Not having a Context declaration to set SOLR/HOME via JNDI
Make sure a file exists under conf/Catalina/localhost with the name of the web-app you want to use say for example "solr" would be solr.xml -- here are its contents:
<Context docBase="/home/java/apache-solr-1.2.0.war" debug="0" crossContext="true" > <Environment name="solr/home" type="java.lang.String" value="/tmp/solr/home" override="true" /> </Context>
2) Running tomcat with security policies enabled
Edit /etc/default/tomcat5.5 and change #TOMCAT_SECURITY=yes to TOMCAT_SECURITY=no (Note: Remove the HASH to un-comment this configuration setting)
This got me running on Debian Etch -- hope this helps.