在使用wordcount时,突然报错:
Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster Please check whether your etc/hadoop/mapred-site.xml contains the below configuration:yarn.app.mapreduce.am.env HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory} mapreduce.map.env HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory} mapreduce.reduce.env HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}
经过搜索后,需要在yarn-site.xml中添加classpath信息。
先查到Hadoop的classpath:
hadoop classpath
复制内容,很长的一串。
然后打开自己安装的Hadoop目录下的yarn-site.xml,位置在 Hadoop目录/etc/hadoop/yarn-site.xml.
在configuration标签中,加入以下代码块
yarn.application.classpath 复制的Hadoop classpath信息
加入后,记得分发到集群中的其他服务器上
然后在你配置了 ResourceManager 的节点的机器上关闭 YARN并重新启动即可。
sbin/stop-yarn.sh sbin/start-yarn.sh



