NoClassDefFoundError on Solr replication slave

I've recently been working on a project for a client that required Solr 3.4 (which we implemented using these packages for Ubuntu 10.04)

Additionally, in production we've implemented two solr servers in replication (one master, one slave).

Having never done this before, I followed the example in the solrconfig.xml that was commented out, as well as this documentation.

Restarting the master worked just fine. However, the slave threw a nice big (when is it never big?) Java stacktrace that looked something like this:

SEVERE: Could not start SOLR. Check solr/home property java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.(MultiThreadedHttpConnectionManager.java:70) at org.apache.solr.handler.SnapPuller.createHttpClient(SnapPuller.java:110) at org.apache.solr.handler.SnapPuller.(SnapPuller.java:138) at org.apache.solr.handler.ReplicationHandler.inform(ReplicationHandler.java:775) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:486) at org.apache.solr.core.SolrCore.(SolrCore.java:589) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at
(snip)
QuerySenderListener sending requests to Searcher@207ff5b6 main 03/11/2010 2:11:12 AM org.apache.solr.common.SolrException log SEVERE: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.

For reasons that are beyond me, this is something to do with this log commons.jar not being loaded when Tomcat starts up. I don't know why it only affects the slave either.

The fix was simple, I found it on StackOverflow:

Append this with a comma, to 'common.loader' in /etc/tomcat6/catalina.properties:

,/usr/share/java/*.jar

Restart tomcat6 on the slave and you should be fine.

Tags: