Thursday, June 22, 2017

RCA: /usr/java/jre1.8.0_112/bin/bin/java: No such file or directory

QA reported one issue observed in their environment:
Searching for java...
        1. /usr/java/jdk1.6.0_31/bin/java
        2. /usr/java/jdk1.6.0_31/jre/bin/java
        3. /usr/java/jdk1.7.0_67-cloudera/bin/java
        4. /usr/java/jdk1.7.0_67-cloudera/jre/bin/java
        5. /usr/java/jre1.8.0_112/bin/java
        6. Specify location of java to use.
Type the number for the required java from this list: [1] 5

/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/bin/../lib/hadoop/bin/hadoop: line 144: /usr/java/jre1.8.0_112/bin/bin/java: No such file or directory

/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/bin/../lib/hadoop/bin/hadoop: line 144: exec: /usr/java/jre1.8.0_112/bin/bin/java: cannot execute: No such file or directory
Note that the choice in the list is correct, but the script then invokes a “bin/bin/java” – where did it get that from?


Well, well, at the beginning I thought there was something wrong in our script using the specified Java directory(JAVA_HOME, PATH). While digging deeper, the error comes from:
-bash-3.2# /usr/bin/hadoop classpath --glob
/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/bin/../lib/hadoop/bin/hadoop: line 144: /usr/java/jre1.8.0_112/bin/bin/java: No such file or directory

/opt/cloudera/parcels/CDH-5.4.4-1.cdh5.4.4.p0.4/bin/../lib/hadoop/bin/hadoop: line 144: exec: /usr/java/jre1.8.0_112/bin/bin/java: cannot execute: No such file or directory

Check JAVA_HOME:
-bash-3.2# echo $JAVA_HOME
/usr/java/jre1.8.0_112/bin
-bash-3.2#

OMG, The above $JAVA_HOME is incorrect.

THE JAVA_HOME/JRE_HOME should be the installation directory, not the bin directory under it.

Correct it with

-bash-3.2# export JAVA_HOME=/usr/java/jre1.8.0_112

Documentation from Oracle:
https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/


No comments: