Running Solr on Debian with Tomcat

SOLR, “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.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Reddit

2 Responses to “Running Solr on Debian with Tomcat”

  1. If you do not want to completely disable the security manager, you can put this in catalina.policy or policy.d/50user.policy in your tomcat directory:

    grant codeBase “file:${catalina.home}/webapps/solr/-” {
    permission java.security.AllPermission;
    };

  2. Albert,
    Thanks for the tip — will be a big help.

    I had meant to take a closer look at the policy settings but never got around to it.

    Thanks again,
    Yousef

Leave a Reply