diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java
index a0055c5b07..3f50c3fda3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java
@@ -564,9 +564,11 @@ protected void handleContainerExitWithFailure(ContainerId containerID,
errorFileIS = fileSystem.open(errorFile);
errorFileIS.readFully(startPosition, tailBuffer);
+ String tailBufferMsg = new String(tailBuffer, StandardCharsets.UTF_8);
diagnosticInfo.append("Last ").append(tailSizeInBytes)
.append(" bytes of ").append(errorFile.getName()).append(" :\n")
- .append(new String(tailBuffer, StandardCharsets.UTF_8));
+ .append(tailBufferMsg).append("\n")
+ .append(analysesErrorMsgOfContainerExitWithFailure(tailBufferMsg));
}
} catch (IOException e) {
LOG.error("Failed to get tail of the container's error log file", e);
@@ -580,6 +582,29 @@ protected void handleContainerExitWithFailure(ContainerId containerID,
diagnosticInfo.toString()));
}
+ private String analysesErrorMsgOfContainerExitWithFailure(String errorMsg) {
+ StringBuilder analysis = new StringBuilder();
+ if (errorMsg.indexOf("Error: Could not find or load main class"
+ + " org.apache.hadoop.mapreduce") != -1) {
+ analysis.append("Please check whether your etc/hadoop/mapred-site.xml "
+ + "contains the below configuration:\n");
+ analysis.append("\n")
+ .append(" yarn.app.mapreduce.am.env\n")
+ .append(" HADOOP_MAPRED_HOME=${full path of your hadoop "
+ + "distribution directory}\n")
+ .append("\n\n")
+ .append(" mapreduce.map.env\n")
+ .append(" HADOOP_MAPRED_HOME=${full path of your hadoop "
+ + "distribution directory}\n")
+ .append("\n\n")
+ .append(" mapreduce.reduce.e nv\n")
+ .append(" HADOOP_MAPRED_HOME=${full path of your hadoop "
+ + "distribution directory}\n")
+ .append("\n");
+ }
+ return analysis.toString();
+ }
+
protected String getPidFileSubpath(String appIdStr, String containerIdStr) {
return getContainerPrivateDir(appIdStr, containerIdStr) + Path.SEPARATOR
+ String.format(ContainerLaunch.PID_FILE_NAME_FMT, containerIdStr);