setting up Alluxio cluster, path points to Java 8 but Alluxio thinks it's java 7? - alluxio

I am setting up an Alluxio cluster. I ran the script ./bin/alluxio-start.sh all SudoMount, but got this error Error: Alluxio requires Java 8 or Java 11, currently Java 1.7.0_321 found. I already set JAVA_HOME and add it to $PATH to point to Java 8. Why does Alluxio still think it is java 7?
$$echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64
…$ java -version
openjdk version “1.8.0_322”

run this and see what’s the output: sudo update-alternatives --display java
if it’s linked to 1.7 then you can use following command to set it to 1.8 sudo update-alternatives --config java

Related

How to I know which Java variable/path is the one I need, I updated my ubuntu, now hadoop and hives won't work

Background first, I installed hadoop on ubuntu 14, but now I updated it to 16, and the java was updated too, from 1.7 to 1.8. But now my hadoop won't work and I'm trying install Hives. I updated my bashrc and source it, but hadoop still won't work.
This is my current java home:
dachen#dachen-VirtualBox:~$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
dachen#dachen-VirtualBox:~$
But when I tried to open my usr/lib/jvm folder, there are two java, which one should I use for my java path for hadoop and hives? The java 1.8 or java-8? I mean to edit the bashrc for hadoop and hives?
dachen#dachen-VirtualBox:~$ cd /usr/lib/jvm
dachen#dachen-VirtualBox:/usr/lib/jvm$ ls
default-java java-1.8.0-openjdk-amd64 java-8-openjdk-amd64
dachen#dachen-VirtualBox:/usr/lib/jvm$
I also tried this command, I believe it is to find your default java path, it gave me this:
dachen#dachen-VirtualBox:~$ sudo update-alternatives --config java
[sudo] password for dachen:
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.
dachen#dachen-Virtual

hadoop -version giving me wrong result why? Hadoop 1.2.1

I executed below command: hadoop -version on hadoop version 1.2.1
vishrant#ubuntu:~$ hadoop -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1)
OpenJDK Server VM (build 24.79-b02, mixed mode)
I was expecting hadoop version but I got the version of JDK installed on my system. I know that correct command is hadoop version [without hyphen] but instead of getting error I got the version of JDK why?
It looks like the hadoop script for 1.2.x has much less checking than more recent versions, at this point (2016) its about 3 years old. You can see the source for it here.
In the 1.2.x script if you type hadoop -version the script will hit the final else statement where it works out what class to run and sets $CLASS to $COMMAND (line 338) instead of a class.
You can see what it will run on line 434:
exec "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$#"
So if you type hadoop version it will run (removed classpath stuff to keep it short):
java -Dproc_version -Xmx1000m -classpath <LIBS> org.apache.hadoop.util.VersionInfo
If you type hadoop -version you get:
java -Dproc_-version -Xmx1000m -classpath <LIBS> -version
So because the default behavior is to set $CLASS to $COMMAND you basically end up with it running:
java -version
Which is what you're getting.

java_home error: change version of java or hadoop-env.sh file?

When installing Single Node Setup for Hadoop 2.6.0 on Mac 10.7.5, the manual http://hadoop.apache.org/docs/r1.2.1/single_node_setup.html requires to update java_home.
Namely,
In Prepare to Start the Hadoop Cluster section, it says:
"In the distribution, edit the file conf/hadoop-env.sh to define at least JAVA_HOME to be the root of your Java installation."
I use the result of terminal query '/usr/libexec/java_home', which is
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home,
for the value of java_home.
As a result, hadoop scripts do not work due to error: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home: bad substitution.
The mistake is likely to be due to mismatch of currently installed on Mac.
My Java is 8.0_25 and the one hadoop uses is 6.0_05 (preferably from Sun). Also, this is the path of jdk and not jre, as may be needed.
Unfortunately, I have not found any java ire 1.6.x for any x for Mac OS in Oracle Java archives. http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
Hadoop requires jdk 1.6 or higher. For finding the location of already installed java, do the following steps.
In the linux command line type the command which java
This may give you a location if java is already installed and added to path.
Type ll
This will give you the exact location where the java is present.
Eg:
which java
/usr/bin/java
ls -all /usr/bin/java
lrwxrwxrwx 1 root root 22 Sep 17 09:43 /usr/bin/java -> /etc/alternatives/java
ls -all /etc/alternatives/java
lrwxrwxrwx 1 root root 35 Sep 17 09:43 /etc/alternatives/java -> /usr/lib/jvm/jdk1.7.0_60/bin/java
In this case, the value of JAVA_HOME will be /usr/lib/jvm/jdk1.7.0_60
Use this value and add it in the hadoop-env.sh
Eg:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_60
If jdk is not present, you have to install jdk.
You mentioned about JRE. You should use JDK. JDK for MAC is available in oracle website.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
The installation document that you are following is of version 1.2.1 and the hadoop version that you have is 2.6.0. Use the proper installation document.
http://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-common/SingleCluster.html

Webstart running the wrong jre version on OSX

I am running a jnlp in OSX 10.8.2 with jre the jre version 1.7.0_11 and jnlp tag is set to run in 1.6 as:
<j2se version="1.6" href="http://java.sun.com/products/autodl/j2se">
or
<j2se version="1.6*" ...>
However, when the jnlp runs shows the following in the console:
Java Web Start 10.11.2.21
Using JRE version 1.7.0_11-b21 Java HotSpot(TM) 64-Bit Server
When I run the same jnlp file in windows using jre 1.7 works fine, it loads with jre 1.7 and then download jre 1.6 and run on it.
Any ideas?
Now, they told me they need java 1.7 as default.
So, I found that installing JDK 1.7 instead of JRE, it was fixed. I can have both versions and my jnlp is using jre 1.6 to run.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
And then I had to run the follwoing commands from http://support.apple.com/kb/HT5559:
sudo mkdir -p /Library/Internet\ Plug-Ins/disabled
sudo mv /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin /Library/Internet\ Plug-Ins/disabled
sudo ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws
After run this, the java applet plug-in starts to work in Chrome and I can handle all versions of Java from Application/Utilities/JavaPreferences
The root cause:
jnlp is set to only use java 1.6 otherwise download it from auto download site and installed automatically
All java versions for mac but 1.7 were developed by Apple so they do not have autodownload url
After 1.7 oracle is developing java for macs
When I review the java preferences only found java 1.7
Jnlp looks for java 1.6 and is unable to find it and try to autodownload and is unable to do it either, so the only option it has is run on java 1.7
To solve this we uninstall java 1.7 and then we use the following instructions to make 1.6 java default:
http://support.apple.com/kb/dl1573
http://blog.nominet.org.uk/tech/2008/04/24/restarting-the-awt-native-event-thread/
http://support.apple.com/kb/HT5559
Then we had a problem with certificates but we did the following:
https://stackoverflow.com/questions/11727955/the-digital-signature-is-not-trusted-java-will-not-allow-any-access-to-this-app
java-will-not-allow-any-access-to-this-app
fix these links to get java -version pointing to 7
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/ CurrentJDK
sudo ln -s CurrentJDK 1.7
sudo ln -s CurrentJDK 1.7.0
you could create links to the old 1.6
sudo rm 1.6 1.6.0
sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents 1.6
sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents 1.6.0

tomcat7 UnsupportedClassVersionError when running with java7

problem: when deploying my war to tomcat7 i get the error
java.lang.UnsupportedClassVersionError: org.MyLibraryClass : Unsupported major.minor version 51.0
(this is the error one gets when compiling java with a newer version than the java used when running the code.)
situation, in order:
brand new ubuntu 12.04.1 server 64bit minimal, in a virtualbox
installed tomcat6
tried to deploy my war
realized the error, and that i need java7 because ubuntu 12 still comes with outdated java
installed oracle java 7 using this guide https://askubuntu.com/questions/197248/java-on-ubuntu-server-12-04
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
removed tomcat6 and installed tomcat7
sudo apt-get remove tomcat6-common
sudo apt-get install tomcat7
deployed my war to tomcat7
started tomcat
sudo service tomcat7 start
checked my app's log file. same error.
echo $JAVA_HOME is empty, java -version shows:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
it's a default tomcat7 install, no modification. still i checked the startup scripts and config to make sure no custom java version is specified anywhere. also checked by asking catalina:
ubuntu#ubuntu:/home$ /usr/share/tomcat7/bin/catalina.sh version
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Jul 19 2012 03:21:30
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.2.0-29-generic
Architecture: amd64
JVM Version: 1.7.0_07-b10
JVM Vendor: Oracle Corporation
now i'm stuck. i don't see how any java code could fail to run on oracle's jre7.
my war is a brand new very basic hello world grails 2.1 app with maven, which has a maven dependency (org.MyLibraryClass) that is compiled with jdk7. that's the one for which i get the error.
in grails i changed BuildConfig.groovy to have 1.7 instead of 1.6:
grails.project.target.level = 1.7
grails.project.source.level = 1.7
then did a grails clean, rebuild, war, redeploy. no change.
any idea what to try next?
Typical error when compiling code with Java7 and running it under Java6.
The critical line in your query is this one I think:
sudo service tomcat7 start
I think it may be triggering the inheritance of OpenJDK still in the system there. What you want to do is instead try tomcat from your own environment.
Login as your normal user
java -version
/usr/share/tomcat7/bin/startup.sh
and check. You should also login as a clean user, root or elsewhere and check java -version to check.
If all else fails, go to /etc/profile and make sure path to Oracle's Java/bin directory is the very first thing in the PATH variable for the environment.
I have the same problem just now,but now it's solved.
Please check this symbolic
/usr/lib/jvm/default-java
it's default link is open-jdk, reset the correct jdk dirctory.
good luck!

Resources