gpt4 book ai didi

java - Sunspot::Solr::Server::JavaMissing:您需要一个 Java 运行时环境来运行 Solr 服务器

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:09:55 24 4
gpt4 key购买 nike

尝试使用 sunspot 启动 Solr,但由于出现此错误而遇到 Java 运行时环境问题。

root@oktobTest:~# dokku run oktob bundle exec rake sunspot:solr:start
rake aborted!
Sunspot::Solr::Server::JavaMissing: You need a Java Runtime Environment to run the Solr server
/app/vendor/bundle/ruby/2.1.0/gems/sunspot_solr-2.2.0/lib/sunspot/solr/server.rb:203:in `ensure_java_installed'
/app/vendor/bundle/ruby/2.1.0/gems/sunspot_solr-2.2.0/lib/sunspot/solr/server.rb:27:in `initialize'
/app/vendor/bundle/ruby/2.1.0/gems/sunspot_solr-2.2.0/lib/sunspot/solr/tasks.rb:38:in `new'
/app/vendor/bundle/ruby/2.1.0/gems/sunspot_solr-2.2.0/lib/sunspot/solr/tasks.rb:38:in `server'
/app/vendor/bundle/ruby/2.1.0/gems/sunspot_solr-2.2.0/lib/sunspot/solr/tasks.rb:10:in `block (3 levels) in <top (required)>'
Tasks: TOP => sunspot:solr:start
(See full trace by running task with --trace)

Solar 在远程服务器上启动并运行。

Java 已安装

root@oktobTest:~# which java
/usr/bin/java

这是 sudo update-alternatives --config java 的输出

root@oktobTest:~# sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1073 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode
3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1073 manual mode

我编辑了 /etc/profile 文件以导出受讨论启发的路径 hereherejavaandme

JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

我不确定上面的路径是否正确。

config/sunspot.xml 文件

production:
solr:
hostname: localhost
port: 8983
log_level: WARNING
path: /solr/production
# read_timeout: 2
# open_timeout: 0.5

development:
solr:
hostname: localhost
port: 8982
log_level: INFO
path: /solr/development

test:
solr:
hostname: localhost
port: 8981
log_level: WARNING
path: /solr/test

最佳答案

对我来说,重新安装 JDK( http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html ) 解决了在 El Capitan 中第一次使用 solr 时发生的问题

关于java - Sunspot::Solr::Server::JavaMissing:您需要一个 Java 运行时环境来运行 Solr 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30275856/

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