Trying to start Solr with sunspot but having an issue with the Java Runtime Environment by getting this error.
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 is up and running on the remote server.
Java is installed
root@oktobTest:~# which java
/usr/bin/java
And this is the output of 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
I edited /etc/profile
file to export the path inspired by discussions here and here and javaandme
JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
I'm not sure about the path above is it correct or not.
config/sunspot.xml
file
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时发生的问题
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
By using this command
$ bundle exec rake --execute 'puts which java'
I am getting '/usr/bin/java'.
But by the following command
$ java --version -> 'No Java runtime present, requesting install.
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
So I installed JDK 8 from the link:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
for 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)
After that Solr server run successfully :) .
In your case you have to reinstall the JDK from the above link to make it work
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 )
Run the Solr server background by
$ bundle exec rake sunspot:solr:start -t
Successfully started Solr ...
Stop Solr server:
$ bundle exec rake sunspot:solr:stop -t
Start solr server in the foreground:
$ bundle exec rake sunspot:solr:run -t
There are some topics about this problem. If you are sure that Java on the server is fine, please try to paste in configuration file (config/sunspot.yml) for the relevant environment this line "solr_home: solr" and start solr server by "RAILS_ENV=[your_env] bundle exec sunspot:solr:start"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.