I restarted my Rails 4 VPS and Solr was obviously also shutdown. I am now trying to startup Solr but when I run the following RAILS_ENV=production bundle exec rake sunspot:solr:start I get the following error message:
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)
The weird thing is that Java is installed:
$ 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)
I'm not sure what might be causing this behavior. Any suggestions?
Try adding to PATH the folder where java is, like this:
export PATH=$PATH:/path/to/java/bin
so that java could be callable from everywhere without specifying the folder.
Launching this before calling rake solved the problem for me.
Related
I have Jenkins server which works on Java 8 but, he should make mvn install before deployment. But compiled applications use Java 14.
After Java 14 was installed, Jenkins starting crash with
$ sudo service jenkins start Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
With Java 14
$ java -version
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Jenkins not work.
How I can be sure what Jenkins runs with the 8th version but my app compiling with the 14th version without Docker?
Perhaps I can use JRE from 8th and Compiler from 14th somehow? Or use 8th as active and 14th only for compile but how?
Java:
$ update-java-alternatives --list
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
java-14-oracle 1091 /usr/lib/jvm/java-14-oracle
Ubuntu: Ubuntu 18.04.4 LTS
I am not a Java/Jenkins developer.
Generally, in these cases where multiple program versions are involved, setting the application configuration to use a specific Java version works best, if the application supports that kind of configuration of course. You should check whether you can specify either of Jenkins or the compiler to use certain Java environment.
If that is not possible, then give it a try using environment variables. First, set Java 14 as the default so the compiler gets the latest version. Second, just before starting the Jenkins server, change Java environment temporarily, so that Jenkins sees Java 8 while running,
$ export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64" \
&& export PATH=$JAVA_HOME/bin:$PATH \
&& java -jar jenkins.war --httpPort=8080
On another note, using Docker in these scenarios is really a good idea. You should consider that.
I hope this helps.
I'm trying to install RapidMiner Studio and I'm having problems related with Java, running the installation file RapidMiner-Studio.sh in my terminal (OS Ubuntu 18.04). I think I have all the requirements to install RapidMiner. I found out I had to have Java 8 or OpenJDK 8, so I installed and configured as explained here. Also, from the same source's suggestions, I added this in the .sh file: --add-modules=java.xml.bind (after eval \"$JAVA\"). Like this:
if [ $# -gt 0 ]; then
eval \"$JAVA\" --add-modules=java.xml.bind $JVM_OPTIONS -cp \"${rmClasspath}\" com.rapidminer.launcher.GUILauncher \"$#\"
else
eval \"$JAVA\" --add-modules=java.xml.bind $JVM_OPTIONS -cp \"${rmClasspath}\" com.rapidminer.launcher.GUILauncher
fi
My OpenJDK version is this:
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
So, the errors I got from the installation file (after doing chmod +x RapidMiner-Studio.sh and ./RapidMiner-Studio.sh) are the following:
Error: Could not find or load main class com.rapidminer.launcher.JVMOptionBuilder
Unrecognized option: --add-modules=java.xml.bind
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
It's clear it doesn't recognize the added module java.xml.bind.
So without that added module in the .sh file, I removed it. And running, I got the following errors:
Error: Could not find or load main class com.rapidminer.launcher.JVMOptionBuilder
Error: Could not find or load main class com.rapidminer.launcher.GUILauncher
How can I solve this Java problem?
Thank you for your attention.
I'm answering my question. So, to solve this, I simply had to replace the original line rmClasspath="${RAPIDMINER_HOME}"/lib/* with rmClasspath=./lib/*. This wasn't about the Java, but really the shell script. I had defined RAPIDMINER_HOME previously and somehow itwasn't reconized in that if statement.
I have the following problem: I would like to have a .sh file that starts a jar file so I have created one with nano and added the following:
java -jar myjarfile.jar
But Java gives me the following error "Error: Unable to access jarfile myjarfile.jar" so I tried to start it directly from the console with the same command. This works without problems so I checked the rights:
chmod 775 myjarfile.jar
chmod 775 start.sh
But I have exactly the same result. So I tried it with the root account but that did not help either. So slowly I'm a little bit desperate because I can not think of it anymore...
System information:
Linux version 4.9.0-8-amd64 (debian-kernel#lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08)
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
Thanks for any answer :)
I am running jmeter 4.0 on my centos 7 system from command line but getting below error, please help.
JMeter command:-
./jmeter -n -t file_load.jmx -l loadResult.csv
Error:
Unrecognized VM option 'MaxMetaspaceSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
java -version
Picked up _JAVA_OPTIONS: -Xmx512M
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
Make sure you really run JMeter with Java 8, double-check which Java you're using via alternatives --config java command
For instance I cannot reproduce your issue with Java 8 but with Java 7 it fails:
As per What’s New in JMeter 4.0? article you need to use at least Java 8 to run JMeter 4.0
I'm using Talend 5.4.1 (from the VM).
I'm getting the following error when trying to run talend job (from each of the projects):
Error:
Could not find or load main class expenses_2.etladtech_0_1.ETLADTECH.
for more help i added the java version i'm using. (after observing the issue in other posts i saw that it's recommended to add it)
so I ran the command from the cmd of the VM:
[root#dev-talend1 ~]# java -version
Response:
classpath=.;%JAVA_HOME%\jre\lib\rt.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\too ls.jar;
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)
bash: fg: %JAVA_HOME%jrelibrt.jar: no such job
bash: fg: %JAVA_HOME%libdt.jar: no such job
bash: fg: %JAVA_HOME%libtools.jar: no such job
You have new mail in /var/spool/mail/root
[root#dev-talend1 ~]#
what can i do to solve it?
You're using Windows environment variables (%JAVA_HOME%) on a Unix machine. Use $JAVA_HOME instead. And don't run services as root.
Thanks for the quick responses.
In the end i didn't find the cause for the error but after upgrading to a newer version of Talend 5.6.0 it was fixed.