Reply
Highlighted
New Contributor
Posts: 14
Registered: ‎03-31-2014

How to install Java 1.7 with Cloudera Manager?

[ Edited ]

Hello,

 

I am using Cloudera Manager to install CDH4 on an Amazon-EC2 cluster. I am using the latest version of CM, this is the command I am using to get the installation directory:

 

$ wget http://archive.cloudera.com/cm4/installer/latest/cloudera-manager-installer.bin

 

During cluster installtion using CM, it installs jdk1.6. 

 

jdk1.6.jpg

 

My question is, is there a way to install jdk 1.7 by default? Is there a version of CM which does that? Or is there a way do this using latest CM version? I have already written a script which can replace jdk1.6 with jdk1.7, but I am hoping to find a simpler solution.

 

Thanks.

Cloudera Employee
Posts: 509
Registered: ‎07-30-2013

Re: How to install Java 1.7 with Cloudera Manager?

Hi,

 

Your URL has "cm4" in it, so it's not installing the latest version of CM. It's installing the latest version of CM in the 4.x line.

 

CM 5 will install JDK 7 by default. Try this URL instead:

http://archive.cloudera.com/cm5/installer/latest/

 

Thanks,

Darren

New Contributor
Posts: 14
Registered: ‎03-31-2014

Re: How to install Java 1.7 with Cloudera Manager?

Hi Darren,

 

I tried CM5 and it installed JDK 1.7 while installing the CM. But during the cluster installation, it installed both JDK 1.6 and 1.7 on each node. First it installed 1.6 and then 1.7. (I selected CDH 4.x)

 

jdk1.7.jpg

 

After the installtion if I check the java version on each node, it is showing only JDK1.6

 

root@ip-10-226-176-29:/home/ubuntu# java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

 

ubuntu@ip-10-36-39-11:~$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

 

Where is JDK 1.7? Did I do something wrong?

 

Thanks,

Bhushan

Cloudera Employee
Posts: 509
Registered: ‎07-30-2013

Re: How to install Java 1.7 with Cloudera Manager?

Hi Bhushan,

Even though both JDK6 and 7 are installed, and java -version reports Java 6, CM and all CDH daemons will automatically pick the correct version of Java. They do not rely on what is on the path by default.

CM 5 will prefer JDK 7 or JDK 6 (but works with both)

CDH 5 requires JDK 7 and will pick it even if the wrong java (or no java) is on the path.

CDH 4 generally prefers JDK 6.

You can see both java versions installed side by side, usually in /usr/java.

Thanks,
Darren
New Contributor
Posts: 14
Registered: ‎03-31-2014

Re: How to install Java 1.7 with Cloudera Manager?

Hi Darren,

 

So, by "CDH 4 generally prefers JDK 6" you mean it will pick up JDK1.6 and if my Hadoop job requires 1.7, the job will fail, right?

 

In that case I guess I will have to start using CDH5??

 

Thanks,

Bhushan

Cloudera Employee
Posts: 509
Registered: ‎07-30-2013

Re: How to install Java 1.7 with Cloudera Manager?

If your hadoop job requires 1.7, you'll need to configure your whole cluster to set JAVA_HOME to point to 1.7. Or just remove your JDK 1.6 binaries.

According to documentation, this will work so long as you are using CDH 4.4 or higher:
http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Requirements-and-Sup...
New Contributor
Posts: 14
Registered: ‎03-31-2014

Re: How to install Java 1.7 with Cloudera Manager?

So you mean if the Hadoop job requires JDK1.7, there is no way to run it directly? One must do some environment variable changes on each node? 

 

 

Cloudera Employee
Posts: 509
Registered: ‎07-30-2013

Re: How to install Java 1.7 with Cloudera Manager?

You need your whole cluster to be on the same JDK version, otherwise stuff will break.

CM5 has a host config to specify the java home. Set this and it will override the detection logic.
New Contributor
Posts: 14
Registered: ‎03-31-2014

Re: How to install Java 1.7 with Cloudera Manager?

[ Edited ]

Hi Darren,

 

I changed the Java Home from CM:

 

java home.jpg

I am still getting error when I try to run my Hadoop job complied on JDK1.7:

 

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mycomp/control/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.util.RunJar.main(RunJar.java:201)

 

 

I also restarted the whole cluster after changing the property in CM.

 

Not sure what I am missing.

Cloudera Employee
Posts: 509
Registered: ‎07-30-2013

Re: How to install Java 1.7 with Cloudera Manager?

Did you restart your cluster?