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.

Error: JAVA_HOME is not set and Java could not be found

Solved Go to solution

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

how to set java_home ?  

who can help me ?

Re: Error: JAVA_HOME is not set and Java could not be found

Super Collaborator

you can set "JAVA_HOME" in /etc/defaults/cloudera-scm-server

 

add to the end of the file

 

export JAVA_HOME=/usr/java/jdk1.7.0_55

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

Thank you for your help 

I set the java_home in /etc/default/cloudera-scm-server with 'export JAVA_HOME=/usr/java/jdk1.7.0_55-cloudera',but when click 'test connection' in Add Cloudera ManagementService with browser,i got the same error 'Unexpected error. Unable to verify database connection.', and the /var/log/cloudera-scm-server/cloudera-scm-server.log file show like this:

 

INFO [JvmPauseMonitor:debug.JvmPauseMonitor@236] Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 1024ms: no GCs detected.

+======================================================================+
| Error: JAVA_HOME is not set and Java could not be found |
+----------------------------------------------------------------------+
| Please download the latest Oracle JDK from the Oracle Java web site |
| > http://www.oracle.com/technetwork/java/javase/index.html < |
| |
| Cloudera Manager requires Java 1.6 or later. |
| NOTE: This script will find Oracle Java whether you install using |
| the binary or the RPM based installer. |
+======================================================================+
+ exit 1

 

Here is the java_home configure show:

[root@cdh1 ~]# tail /etc/default/cloudera-scm-server
# Java Options.
#
# Default value sets Java maximum heap size to 2GB, and Java maximum permanent
# generation size to 256MB.
#

export CMF_JAVA_OPTS="-Xmx2G -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp"
export JAVA_HOME=/usr/java/jdk1.7.0_55-cloudera
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
[root@cdh1 ~]#
[root@cdh1 ~]#
[root@cdh1 ~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_55-cloudera/
[root@cdh1 ~]# ls /usr/java/jdk1.7.0_55-cloudera/
bin db jre LICENSE README.html src.zip THIRDPARTYLICENSEREADME.txt
COPYRIGHT include lib man release THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@cdh1 ~]#

 

Is there something wrong? any how can i do?

Re: Error: JAVA_HOME is not set and Java could not be found

Super Collaborator

OK so realize NONE of this should be necessary, and this is not normal to need to configure things this way.  It is not necessary to have to set JAVA_HOME.

 

I think we need to focus on this part of the message, rather than the JAVA_HOME message which appears to be a false-positive error.

 

INFO [JvmPauseMonitor:debug.JvmPauseMonitor@236] Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 1024ms: no GCs detected.

 

How much memory is configured for your VM you are attempting to run things on?  How much physical memory does the system you are running the VM on have?

 

It appears the 1.7 openJDK has been installed as well, which is alongside of the oracle JDK on the system.

 

What do you get for the following commands on the system:

 

# ls -l /usr/java

# yum list installed "*jdk*"


Thanks

Todd

 

 

 

 

 

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

Thank you for your reply!

The memory is configured for my VM i'm attempting to run things on is 512MB, and physical memory the system i'm running the VM on is 8GB.

The following commands on the system get like this:

 

# ls -l /usr/java

total 4
drwxr-xr-x. 8 root root 4096 Sep 19 18:05 jdk1.7.0_55-cloudera

 

# yum list installed "*jdk*"

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* extras: mirrors.cug.edu.cn
* updates: mirrors.btte.net
base | 3.7 kB 00:00
extras | 3.3 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 5.3 MB 00:01
Installed Packages
java-1.7.0-openjdk.x86_64 1:1.7.0.65-2.5.1.2.el6_5 @updates

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

Thank you for your help!

Memory configured for VM running things on is 512MB,and the physical memory the VM running on is 8GB.

The following commands get show:

 

[root@cdh1 ~]# ls -l /usr/java
total 4
drwxr-xr-x. 8 root root 4096 Sep 19 18:05 jdk1.7.0_55-cloudera

 

[root@cdh1 ~]# yum list installed "*jdk*"
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
base | 3.7 kB 00:00
extras | 3.3 kB 00:00
updates | 3.4 kB 00:00
Installed Packages
java-1.7.0-openjdk.x86_64 1:1.7.0.65-2.5.1.2.el6_5 @updates

Re: Error: JAVA_HOME is not set and Java could not be found

Super Collaborator

Ok at this point I would suggest reviewing the "requirements" section, here.

 

http://www.cloudera.com/content/cloudera-content/cloudera-docs/CM5/latest/Cloudera-Manager-Installat...

 

Also realize you need memory for CDH, so running the VM at a minimum of 4GB memory is necessary.


The issue you are seeing is because there is not enough memory, Cloudera Manager and CDH are memory intensive applicaitons.   The JAVA_HOME error message you are seeing is due to this (the message is a false indication of the problem, as I stated in my previous note.

 

 

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

Thank you very much!

I set the memory of VM to 4GB,but i got the same error.

Re: Error: JAVA_HOME is not set and Java could not be found

Explorer

Need i reinstall the centos system?

Re: Error: JAVA_HOME is not set and Java could not be found

Super Collaborator
No, that should not be necessary. Are there error messages in the cloudera manager logs? Exceptions maybe?

Don't have an account?
Coming from Hortonworks? Activate your account here