gpt4 book ai didi

java - Rails 4 : Solr throwing JavaMissing error, 但安装了 Java

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:04:00 25 4
gpt4 key购买 nike

我重新启动了 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)

我不确定是什么导致了这种行为。有什么建议吗?

最佳答案

尝试将 java 所在的文件夹添加到 PATH,如下所示:

export PATH=$PATH:/path/to/java/bin

因此无需指定文件夹即可从任何地方调用 java。

在调用 rake 之前启动这个解决了我的问题。

关于java - Rails 4 : Solr throwing JavaMissing error, 但安装了 Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24534939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com