Sunspot Solr 不是以“您需要 Java 运行时环境来运行 Solr 服务器"开头的 [英] Sunspot Solr not starting with "You need a Java Runtime Environment to run the Solr server"
问题描述
在重新部署我的应用程序并重新启动我的服务器之前,Sunsport Solr 停止并且无法再启动,尽管它在重新部署 + 重新启动之前可以正常工作.当我跑
Before redeploy my application and restart my server, Sunsport Solr stopped and can`t be started anymore, although it was working before the redeploy + restart. When I run
rake sunspot:solr:run RAILS_ENV=production --trace
我收到以下内容
** Invoke sunspot:solr:start (first_time)
** Invoke environment (first_time)
** Execute environment
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
** Execute sunspot:solr:start
rake aborted!
You need a Java Runtime Environment to run the Solr server
但是 java -version 返回以下内容:
But java -version return the following:
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.4.el6_5-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
不知道该怎么办了,已经尝试从应用程序中删除 solr 文件夹并再次运行安装 (rails g sunspot_solr:install),但不走运...
Don`t know what to do anymore, already tried to remove solr folder from the app and run the install again (rails g sunspot_solr:install) , but no lucky...
我使用的是 Ruby 2.0.0 Rails 4.0.0.rc1 和最新版本的 sunspot solt
I`m on Ruby 2.0.0 Rails 4.0.0.rc1 and the last version of sunspot solt
推荐答案
我遇到了同样的错误.运行以下命令时.
I got the same error. When running the following command.
$ bundle exec rake sunspot:solr:start -t
** Invoke sunspot:solr:start (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:start
rake aborted!
Sunspot::Solr::Server::JavaMissing: You need a Java Runtime Environment to run the Solr server
通过使用这个命令
$ bundle exec rake --execute 'puts which java'
我收到/usr/bin/java".
I am getting '/usr/bin/java'.
但是通过下面的命令
$ java --version -> 'No Java runtime present, requesting install.
我使用的是 Mac OSX,它提示一条消息并点击更多信息:
I am using Mac OSX and it prompted a message and clicking on more info it goes to:
oracle.com/technetwork/java/javase/downloads/index.html
所以我从链接安装了 JDK 8:
So I installed JDK 8 from the link:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Mac OSX
http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-macosx-x64.dmg
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
在那之后 Solr 服务器成功运行 :) .
After that Solr server run successfully :) .
在您的情况下,您必须通过上面的链接重新安装 JDK 才能使其正常工作
您有 openJDK 运行时环境.切换到 Java(TM) SE 运行时环境,使 Solr 工作.阅读这个 (difference-between-oracle-jdk-and-open-jdk)
You have openJDK runtime environment. Switch to Java(TM) SE Runtime Environment, to make Solr work. Read this (difference-between-oracle-jdk-and-open-jdk)
运行 Solr 服务器后台
Run the Solr server background by
$ bundle exec rake sunspot:solr:start -t
Successfully started Solr ...
停止 Solr 服务器:
Stop Solr server:
$ bundle exec rake sunspot:solr:stop -t
在前台启动solr服务器:
Start solr server in the foreground:
$ bundle exec rake sunspot:solr:run -t
这篇关于Sunspot Solr 不是以“您需要 Java 运行时环境来运行 Solr 服务器"开头的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!