Exception thrown starting SOLR in Sunspot gem

240 views Asked by At

I just installed sunspot gem (latest version) including the embedded solr into my application. When I run "rake sunspot:solr:start" it says the server started, but then I can't connect and I think it dies quietly - I cannot find the log file for it.

So my first question is: Where is the solr log file supposed to be? I checked my app log directory and there was no log there other than the standard development log.

So I did some searching, and ran rake sunspot:solr:run - it throws this error:

java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple

So I did some more searching and everything indicates a classpath issue, but I can't figure out how to fix it, or why it's happening.

Here's the questions that are related:

Exception thrown while using logback/slf4j

Exception thrown while using logback/slf4j/java

I don't have any other entries on the classpath:

$ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

$ echo $CLASSPATH

Prints nothing

and trying to run solr directly didn't give me any more information on where the problem lies:

$ java -jar start.jar -verbose:CLASS --dry-run
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/bin/java -verbose:CLASS -Djetty.home=/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr -cp /Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-xml-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/servlet-api-3.0.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-http-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-continuation-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-server-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-security-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-servlet-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-webapp-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-deploy-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-util-8.1.8.v20121106.jar:/Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/lib/jetty-io-8.1.8.v20121106.jar org.eclipse.jetty.xml.XmlConfiguration /var/folders/dm/f2j60c396xl3s7y0jt_mgmvw0000gn/T/start1361372392858055131.properties /Users//.rvm/gems/ruby-2.0.0-p247/gems/sunspot_solr-2.1.0/solr/etc/jetty.xml

Could anyone suggest how to recover from this error?

1

There are 1 answers

0
Richard G On

I found the issue, and it was indeed a classpath problem. Luckily I had an older version of SOLR where it was reporting slf4j was bound twice (but still starting).

So this lead me to where the JAR's were, so I've moved these JAR's out of /Library/Java/Extensions directory which had a copy of them (as well as the lib directory for SOLR I think).