Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solr server won't start with 2.1.0 #566

Closed
jakewendt opened this issue Apr 17, 2014 · 5 comments
Closed

solr server won't start with 2.1.0 #566

jakewendt opened this issue Apr 17, 2014 · 5 comments

Comments

@jakewendt
Copy link

I've been trying to upgrade my rails 4 app on my Mac from sunspot 2.0.0 to 2.1.0 to no avail. With sunspot 2.0.0 everything works great, but I like to keep things current, particularly given the existence of a few rails deprecation warnings. But with 2.1.0, the server just won't start. I've tried java 1.6 and 1.7 both with the same results. bundle exec rake sunspot:solr:start would always say it succeeded, but actually failed quietly and bundle exec rake sunspot:solr:run would explicitly fail as shown below.

> java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

I even went so far as to just create a new app and it still won't start.

> rails new sunspot_test --skip-bundle
> cd sunspot_test/
> vi Gemfile 

> cat Gemfile
source 'https://rubygems.org'


gem 'rails', '4.1.0'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development

gem 'sunspot_solr'
gem 'sunspot_rails'



> sudo gem uninstall sunspot sunspot_rails sunspot_solr

> sudo bundle up
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.3.0)
Using i18n (0.6.9)
Using json (1.8.1)
Using minitest (5.3.3)
Using thread_safe (0.3.3)
Using tzinfo (1.1.0)
Using activesupport (4.1.0)
Using builder (3.2.2)
Using erubis (2.7.0)
Using actionview (4.1.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.1.0)
Using mime-types (1.25.1)
Using polyglot (0.3.4)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.1.0)
Using activemodel (4.1.0)
Using arel (5.0.1.20140414130214)
Using activerecord (4.1.0)
Using bundler (1.5.3)
Using coffee-script-source (1.7.0)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.19.1)
Using railties (4.1.0)
Using coffee-rails (4.0.1)
Using hike (1.2.3)
Using multi_json (1.9.2)
Using jbuilder (2.0.6)
Using jquery-rails (3.1.0)
Using mini_portile (0.5.3)
Using nokogiri (1.6.1)
Using pr_geohash (1.0.0)
Using tilt (1.4.1)
Using sprockets (2.11.0)
Using sprockets-rails (2.1.3)
Using rails (4.1.0)
Using rdoc (4.1.1)
Using rsolr (1.0.10)
Using sass (3.2.19)
Using sass-rails (4.0.3)
Using sdoc (0.4.0)
Using spring (1.1.2)
Using sqlite3 (1.3.9)
Installing sunspot (2.1.0)
Installing sunspot_rails (2.1.0)
Installing sunspot_solr (2.1.0)
Using turbolinks (2.2.2)
Using uglifier (2.5.0)
Your bundle is updated!



> rails generate sunspot_rails:install
DEPRECATION WARNING: You have required `active_support/core_ext/object/to_json`. This file will be removed in Rails 4.2. You should require `active_support/core_ext/object/json` instead. (called from <top (required)> at /Users/jakewendt/sunspot_test/config/application.rb:7)
      create  config/sunspot.yml

> bundle exec rake sunspot:solr:run
DEPRECATION WARNING: You have required `active_support/core_ext/object/to_json`. This file will be removed in Rails 4.2. You should require `active_support/core_ext/object/json` instead. (called from <top (required)> at /Users/jakewendt/sunspot_test/config/application.rb:7)
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/admin-extra.html => /Users/jakewendt/sunspot_test/solr/conf/admin-extra.html
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/elevate.xml => /Users/jakewendt/sunspot_test/solr/conf/elevate.xml
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/mapping-ISOLatin1Accent.txt => /Users/jakewendt/sunspot_test/solr/conf/mapping-ISOLatin1Accent.txt
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/protwords.txt => /Users/jakewendt/sunspot_test/solr/conf/protwords.txt
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/schema.xml => /Users/jakewendt/sunspot_test/solr/conf/schema.xml
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/scripts.conf => /Users/jakewendt/sunspot_test/solr/conf/scripts.conf
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/solrconfig.xml => /Users/jakewendt/sunspot_test/solr/conf/solrconfig.xml
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/spellings.txt => /Users/jakewendt/sunspot_test/solr/conf/spellings.txt
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/stopwords.txt => /Users/jakewendt/sunspot_test/solr/conf/stopwords.txt
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/conf/synonyms.txt => /Users/jakewendt/sunspot_test/solr/conf/synonyms.txt
Copying /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr/solr.xml => /Users/jakewendt/sunspot_test/solr
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:472)
    at org.eclipse.jetty.start.Main.start(Main.java:620)
    at org.eclipse.jetty.start.Main.main(Main.java:95)
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
    at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:619)
    at org.eclipse.jetty.util.log.JettyAwareLogger.debug(JettyAwareLogger.java:206)
    at org.eclipse.jetty.util.log.Slf4jLog.debug(Slf4jLog.java:89)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1203)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1189)
    ... 7 more

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information

Does anyone have any suggestions?

@jakewendt
Copy link
Author

I anticipated that this was a Java-related issue and indeed it is. I reviewed the output of ...

cd /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr
java -jar start.jar DEBUG=true

and found that java.library.path and java.ext.dirs both included /Library/Java/Extensions. This folder only contains a few links to some xuggler related libraries.

logback-classic.jar -> /usr/local/xuggler/share/java/jars/logback-classic.jar
logback-core.jar -> /usr/local/xuggler/share/java/jars/logback-core.jar
slf4j-api.jar -> /usr/local/xuggler/share/java/jars/slf4j-api.jar
xuggle-xuggler.jar -> /usr/local/xuggler/share/java/jars/xuggle-xuggler.jar

I tried rerunning the java command and manually setting java.library.path and java.ext.dirs, but it still failed the same way. I renamed /Library/Java/Extensions and it passed (YAY!), but now erred like #561!

Thanks to the following link for pointing me in the right direction.
http://stackoverflow.com/questions/20309223/exception-thrown-starting-solr-in-sunspot-gem

@jakewendt
Copy link
Author

So I managed to get past this issue by editing the gem file sunspot_solr-2.1.0/solr/contexts/solr.xml and replacing the line

<Set name="tempDirectory"><Property name="jetty.home" default="."/>/solr/webapps</Set>

with

<Set name="tempDirectory">/path/to/my/rails/app/solr</Set>

Now, while this does seem to work, I have multiple apps that use sunspot so I'm going to need to find a way to control this in a more app-specific manner.

(Correction. It wasn't actually working. It was silently failing and logged some severe errors.)

@jakewendt
Copy link
Author

I believe that I may have finally got the upgrade working. I created a solr/solr.xml ...

<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
 <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}">
   <core name="production"  instanceDir="." dataDir="data/production"/>
   <core name="development" instanceDir="." dataDir="data/development"/>
   <core name="test"        instanceDir="." dataDir="data/test"/>
 </cores>
</solr>

This is different than the one that sunspot would install. I changed the dataDir values from "production/data" to "data/production" so that I could use my existing indexes.

Editted my sunspot.yml like so ...

production:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING
    solr_home: /full/path/to/production/rails/app/solr
    path: /solr/production

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO
    solr_home: /full/path/to/development/rails/app/solr
    path: /solr/development

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING
    solr_home:/full/path/to/test/rails/app/solr
    path: /solr/test

solr_home had to be absolute or would try to create the folder in the gem's folder.

solr/conf/schema.xml and solr/conf/solrconfig.yml differ between version 2.0.0 and 2.1.0 so I copied them in and remade some modifications.

And last, but not least, I had to create a writable folder within the gem. Either this or edit the gem's solr/contexts/solr.xml. I don't like this, but it works.

sudo mkdir /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr-webapp
sudo chmod 777 /opt/local/lib/ruby2.0/gems/2.0.0/gems/sunspot_solr-2.1.0/solr/solr-webapp

I was concerned that I would need to do a full reindex, but everything seems to be working with the existing index from 2.0.0. I did notice some upgraded file names like solr/data/development/index/_7pn_upgraded.si as well as the creation tlog directories in each environment.

And I'm using the latest java too.

@jakewendt
Copy link
Author

Sadly, something went south and I had to reindex anyway. But with the latest version 2.1.1, there is no longer a need to add and chmod a directory in the gem.

@bragboy
Copy link
Collaborator

bragboy commented Nov 11, 2015

Please free to reopen this issue if its still a problem in the recent versions of sunspot

@bragboy bragboy closed this as completed Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants