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

yarn执行MapReduce任务时,找不到主类导致的

解决:

1、在命令行输入:hadoop classpath

[hadoop@localhost ~]$ hadoop classpath
/data/hadoop/hadoop//etc/hadoop:/data/hadoop/hadoop//share/hadoop/common/lib/*:/data/hadoop/hadoop//share/hadoop/common/*:/data/hadoop/hadoop//share/hadoop/hdfs:/data/hadoop/hadoop//share/hadoop/hdfs/lib/*:/data/hadoop/hadoop//share/hadoop/hdfs/*:/data/hadoop/hadoop//share/hadoop/mapreduce/lib/*:/data/hadoop/hadoop//share/hadoop/mapreduce/*:/data/hadoop/hadoop//share/hadoop/yarn:/data/hadoop/hadoop//share/hadoop/yarn/lib/*:/data/hadoop/hadoop//share/hadoop/yarn/*

2、把上述输出的值添加到yarn-site.xml文件对应的属性 <name>yarn.application.classpath</name>下面,eg:

   <property>
         <name>yarn.application.classpath</name>
         <value>/data/hadoop/hadoop//etc/hadoop:/data/hadoop/hadoop//share/hadooo
p/common/lib/*:/data/hadoop/hadoop//share/hadoop/common/*:/data/hadoop/hadoop//ss
hare/hadoop/hdfs:/data/hadoop/hadoop//share/hadoop/hdfs/lib/*:/data/hadoop/hadooo
p//share/hadoop/hdfs/*:/data/hadoop/hadoop//share/hadoop/mapreduce/lib/*:/data/hh
adoop/hadoop//share/hadoop/mapreduce/*:/data/hadoop/hadoop//share/hadoop/yarn:/dd
ata/hadoop/hadoop//share/hadoop/yarn/lib/*:/data/hadoop/hadoop//share/hadoop/yarr
n/*</value>
   </property>

3、重启yarn,重新跑MapReduce任务。

posted @ 2019-05-08 17:34  北漂-boy  阅读(5095)  评论(0编辑  收藏  举报