【发布时间】:2014-07-02 15:18:23
【问题描述】:
我重新启动了我的 Rails 4 VPS,Solr 显然也关闭了。我现在正在尝试启动 Solr,但是当我运行以下 RAILS_ENV=production bundle exec rake sunspot:solr:start 时,我收到以下错误消息:
rake aborted!
Sunspot::Solr::Server::JavaMissing: You need a Java Runtime Environment to run the Solr server
/home/dani/.rvm/gems/ruby-2.1.2/gems/sunspot_solr-2.1.1/lib/sunspot/solr/server.rb:203:in `ensure_java_installed'
/home/dani/.rvm/gems/ruby-2.1.2/gems/sunspot_solr-2.1.1/lib/sunspot/solr/server.rb:27:in `initialize'
/home/dani/.rvm/gems/ruby-2.1.2/gems/sunspot_solr-2.1.1/lib/sunspot/solr/tasks.rb:37:in `new'
/home/dani/.rvm/gems/ruby-2.1.2/gems/sunspot_solr-2.1.1/lib/sunspot/solr/tasks.rb:37:in `server'
/home/dani/.rvm/gems/ruby-2.1.2/gems/sunspot_solr-2.1.1/lib/sunspot/solr/tasks.rb:5:in `block (3 levels) in <top (required)>'
/home/dani/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/home/dani/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => sunspot:solr:start
(See full trace by running task with --trace)
奇怪的是安装了Java:
$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
$ java -version
java version "1.6.0_31"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1ubuntu1~0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
我不确定是什么导致了这种行为。有什么建议吗?
【问题讨论】:
-
sunspot 如何判断是否安装了 Java:github.com/sunspot/sunspot/blob/v2.1.1/sunspot_solr/lib/sunspot/…
-
从 Rails 控制台运行返回 nil :\ 这可能是原因。
标签: java ruby-on-rails solr