Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
I had the same problem and resolved by adding this in mapred-site.xml (so edit your mapreduce.application.classpath property)
<property>
<name>mapreduce.application.classpath</name>
<value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*,$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*,$HADOOP_MAPRED_HOME/share/hadoop/common/*,$HADOOP_MAPRED_HOME/share/hadoop/common/lib/*,$HADOOP_MAPRED_HOME/share/hadoop/yarn/*,$HADOOP_MAPRED_HOME/share/hadoop/yarn/lib/*,$HADOOP_MAPRED_HOME/share/hadoop/hdfs/*,$HADOOP_MAPRED_HOME/share/hadoop/hdfs/lib/*</value>
</property>
Just edit the mapred-site.xml file :
Add following properties:
<property> <name>mapreduce.framework.name</name> <value>yarn</value> </property>
<property> <name>yarn.app.mapreduce.am.env</name> <value>HADOOP_MAPRED_HOME=/Users/adityaatri/Applications/hadoop-3.1.3</value> </property>
<property> <name>mapreduce.map.env</name> <value>HADOOP_MAPRED_HOME=/Users/adityaatri/Applications/hadoop-3.1.3</value> </property>
<property> <name>mapreduce.reduce.env</name> <value>HADOOP_MAPRED_HOME=/Users/adityaatri/Applications/hadoop-3.1.3</value> </property>
Now for all the above 4 properties, replace the path /Users/adityaatri/Applications/hadoop-3.1.3
with your Hadoop Home Address.
Now add the 5th property :
<property> <name>mapreduce.application.classpath</name> <value></value> </property>
The <value>
element must be filled with content after executing below commands in your terminal :
export HADOOP_CLASSPATH=$(hadoop classpath)
echo $HADOOP_CLASSPATH
The output from my terminal :
/Users/adityaatri/Applications/hadoop-3.1.3/etc/hadoop:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/common/lib/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/common/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/hdfs:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/hdfs/lib/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/hdfs/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/mapreduce/lib/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/mapreduce/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/yarn:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/yarn/lib/*:/Users/adityaatri/Applications/hadoop-3.1.3/share/hadoop/yarn/*
Copy this content inside the <value>
element of the 5th property.
Now you will not get any error. :)