Hadoop MapReduce错误 - / bin / bash:/ bin / java:是一个目录 [英] Hadoop MapReduce Error - /bin/bash: /bin/java: is a directory
问题描述
我试图在macOS 10.12上运行一个基本的MapReduce程序,它从天气数据的日志文件中检索最高温度。在运行作业时,我收到以下堆栈跟踪:
堆栈跟踪:ExitCodeException exitCode = 126:
at org .apache.hadoop.util.Shell.runCommand(Shell.java:582)
at org.apache.hadoop.util.Shell.run(Shell.java:479)
at org.apache.hadoop .util.Shell $ ShellCommandExecutor.execute(Shell.java:773)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:212)
at org.apache .hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch。 java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在java.l ang.Thread.run(Thread.java:745)
作业的stderr日志文件位于资源管理器包含以下消息:/ bin / bash:/ bin / java:是一个目录。
我最初收到类似的错误消息/ bin / bash:/ bin / java:没有这样的文件或目录,但修改了hadoop-config.sh脚本,如这篇文章。我修改它如下:
if [[-z $ JAVA_HOME]];那么
#在OSX上使用java_home(或/ Library for旧版本)
if [Darwin==$(uname -s)];那么
如果[-x / usr / libexec / java_home];然后
export JAVA_HOME = $ {JAVA_HOME}
else
export JAVA_HOME = $ {JAVA_HOME}
fi
fi
我的$ JAVA_HOME变量设置为: 这是我的JAVA_HOME变量的配置问题的结果吗? 这是通过对hadoop-env.sh中的JAVA_HOME变量进行硬编码解决的(如最高投票答案中指定的) 更改了这个: 至此: I am attempting to run a basic MapReduce program on macOS 10.12 that retrieves the maximum temperature from a log file of weather data. When running the job, I receive the following stack trace: The stderr log file for the job in the resource manager contains the following message: "/bin/bash: /bin/java: is a directory". I was originally receiving a similar error message, "/bin/bash: /bin/java: No such file or directory", but modified the hadoop-config.sh script as suggested by the answer in this post. I modified it as follows: My $JAVA_HOME variable is set to: Is this a result of a configuration issue with my JAVA_HOME variable? This was resolved by hard-coding the JAVA_HOME variable in hadoop-env.sh (as specified in the highest voted answer to this question) Changed this: To this:
这篇关于Hadoop MapReduce错误 - / bin / bash:/ bin / java:是一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home <
export JAVA_HOME = $ {JAVA_HOME}
export JAVA_HOME = / Library / Java / JavaVirtualMachines / jdk1.8.0_91.jdk / Contents / Home
Stack trace: ExitCodeException exitCode=126:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:582)
at org.apache.hadoop.util.Shell.run(Shell.java:479)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:773)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:212)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
if [[ -z $JAVA_HOME ]]; then
# On OSX use java_home (or /Library for older versions)
if [ "Darwin" == "$(uname -s)" ]; then
if [ -x /usr/libexec/java_home ]; then
export JAVA_HOME=${JAVA_HOME}
else
export JAVA_HOME=${JAVA_HOME}
fi
fi
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home