Skip to content
Advertisement

/bin/bash: /bin/java: No such file or directory error in Yarn apps in MacOS

I was trying to run a simple wordcount MapReduce Program using Java 1.7 SDK and Hadoop2.7.1 on Mac OS X EL Captain 10.11 and I am getting the following error message in my container log “stderr” /bin/bash: /bin/java: No such file or directory

Application Log-

JavaScript

Command I am Running

JavaScript

My ENV variable are-

JavaScript

The problem seems to be because YARN is using different path for JAVA executable different then you have in your OS. the local logs for the failed task in “stderr” shows- /bin/bash: /bin/java: No such file or directory

I tried to create a soft link from $JAVA_HOM/bin/java to /bin/java but in El Captian OS X but its not allowing to create a softlink. The New OS X EL Captian has a rootless login and user can not create anything on certain restricted folders like /bin/. Any work around on this issue is highly appreciated.Thanks in advance.

Advertisement

Answer

This answer is applicable for Hadoop version 2.6.0 and earlier. Disabling SIP and creating a symbolic link does provide a workaround. A better solution is to fix the hadoop-config.sh so it picks up your JAVA_HOME correctly

In HADOOP_HOME/libexec/hadoop-config.sh look for the if condition below where it sets JAVA_HOME

# Attempt to set JAVA_HOME if it is not set

Remove extra parentheses in the export JAVA_HOME lines as below. Change this

JavaScript

to

JavaScript

Restart yarn after you have made this change.

More detailed info can be found here https://issues.apache.org/jira/browse/HADOOP-8717 and seems that Hadoop 3.0.0-alpha1 is the first release with the fix.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement