Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster

自己搭建了一套伪分布的大数据环境,运行Hadoop包中自带的示例时,出现如下错误:

错误: 找不到或无法加载主类 org.apache.hadoop.mapreduce.v2.app.MRAppMaster

原因:

hadoop集群上运行build动作时提示以上错误,原因是yarn-site.xml和mapred-site.xml中的yarn.application.classpath没有进行配置。

解决方法:

找到yarn-site.xml和mapred-site.xml,并在configuration标签中,添加如下代码:

1 <property>
2     <name>yarn.application.classpath</name>
3     <value>
4        /bigdata/hadoop-3.0.3/etc/hadoop:/bigdata/hadoop-3.0.3/share/hadoop/common/lib/*:/bigdata/hadoop-3.0.3/share/hadoop/common/*:/bigdata/hadoop-3.0.3/share/hadoop/hdfs:/bigdata/hadoop-3.0.3/share/hadoop/hdfs/lib/*:/bigdata/hadoop-3.0.3/share/hadoop/hdfs/*:/bigdata/hadoop-3.0.3/share/hadoop/yarn/lib/*:/bigdata/hadoop-3.0.3/share/hadoop/yarn/*:/bigdata/hadoop-3.0.3/share/hadoop/mapreduce/lib/*:/bigdata/hadoop-3.0.3/share/hadoop/mapreduce/*:/bigdata/hadoop-3.0.3/contrib/capacity-scheduler/*.jar
5     </value>
6 </property>

注:我的$HADOOP_HOME=bigdata/hadoop-3.0.3

修改完了,记得format一下。

posted @ 2018-06-26 13:39  D-Arlin  阅读(2636)  评论(0编辑  收藏  举报