Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

I can not start namenode and can not find JAVA_HOME

I can not start namenode and can not find JAVA_HOME

New Contributor

I can not start namenode.

[root@AY1312280620257702e0Z conf]# sudo -u hdfs hdfs namenode -format
Error: JAVA_HOME is not set and could not be found.
[root@AY1312280620257702e0Z conf]# echo $JAVA_HOME
/usr/qiuxin/software/jdk1.7.0_25
[root@AY1312280620257702e0Z conf]# echo $JAVA_HOME
/usr/qiuxin/software/jdk1.7.0_25
[root@AY1312280620257702e0Z conf]# sudo -u hdfs hdfs namenode -format
Error: JAVA_HOME is not set and could not be found.
[root@AY1312280620257702e0Z conf]# java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
[root@AY1312280620257702e0Z conf]#

 

3 REPLIES 3
Highlighted

Re: I can not start namenode and can not find JAVA_HOME

Expert Contributor
Set JAVA_HOME and PATH for all users, something look like below...
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
Try to set it in /etc/profile file, so that it can be picked automatically on next reboot...
Em Jay

Re: I can not start namenode and can not find JAVA_HOME

Expert Contributor

If you are using service scripts (e.g. sudo service hadoop-namenode start, etc.), the environment doesn't get passed on to the service script. If your JDK is located at one of the standard locations, it's detected by the script (using this component called bigtop-utils). However, if it's not, you'd have to go to /etc/default/bigtop-utils and set and export JAVA_HOME there. You only need to do it once and all CDH components would use that variable to figure out where JDK is.

 

Here is some more info about JDK support in case you are curious:

http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Requirements-and-Sup...

Re: I can not start namenode and can not find JAVA_HOME

Try to set JAVA_HOME variable in each components env.sh file (e.g. for NameNode and DataNode set your JAVA_HOME variable in hadoop-env.sh file)

 

Because as per my experience I have observed that Oozie is not starting if we set JAVA_HOME to Java 1.7. Oozie needs Java 1.6.x version to start service.

 

Solution shared by mgrover is also good but sometimes if oozie give error with latest java version than in that case you need to remove it from global setting i.e. bigtop-utils setting and you need to configure it in each component's env.sh file.

Regards,
Chirag Patadia.
Don't have an account?
Coming from Hortonworks? Activate your account here