hadoop运行mapreduce报错Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster 原创 2021-05-23 15:42 阅读(2802)次 #### 异常问题: 今天运行word count单词统计示例,hadoop运行mapreduce报错Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster 详细错误信息如下: ```xml 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} ``` #### 解决办法: 先手hadoop classpath命令得到classpath: hadoop classpath 如下: ```shell [root@hd1 mapreduce]# hadoop classpath /home/hadoop-3.1.4/etc/hadoop:/home/hadoop-3.1.4/share/hadoop/common/lib/*:/home/hadoop-3.1.4/share/hadoop/common/*:/home/hadoop-3.1.4/share/hadoop/hdfs:/home/hadoop-3.1.4/share/hadoop/hdfs/lib/*:/home/hadoop-3.1.4/share/hadoop/hdfs/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/lib/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/*:/home/hadoop-3.1.4/share/hadoop/yarn:/home/hadoop-3.1.4/share/hadoop/yarn/lib/*:/home/hadoop-3.1.4/share/hadoop/yarn/* ``` 再修改mapred-site.xml配置,增加如下: ```xml yarn.app.mapreduce.am.env HADOOP_MAPRED_HOME=/home/hadoop-3.1.4/etc/hadoop:/home/hadoop-3.1.4/share/hadoop/common/lib/*:/home/hadoop-3.1.4/share/hadoop/common/*:/home/hadoop-3.1.4/share/hadoop/hdfs:/home/hadoop-3.1.4/share/hadoop/hdfs/lib/*:/home/hadoop-3.1.4/share/hadoop/hdfs/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/lib/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/*:/home/hadoop-3.1.4/share/hadoop/yarn:/home/hadoop-3.1.4/share/hadoop/yarn/lib/*:/home/hadoop-3.1.4/share/hadoop/yarn/* mapreduce.map.env HADOOP_MAPRED_HOME=/home/hadoop-3.1.4/etc/hadoop:/home/hadoop-3.1.4/share/hadoop/common/lib/*:/home/hadoop-3.1.4/share/hadoop/common/*:/home/hadoop-3.1.4/share/hadoop/hdfs:/home/hadoop-3.1.4/share/hadoop/hdfs/lib/*:/home/hadoop-3.1.4/share/hadoop/hdfs/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/lib/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/*:/home/hadoop-3.1.4/share/hadoop/yarn:/home/hadoop-3.1.4/share/hadoop/yarn/lib/*:/home/hadoop-3.1.4/share/hadoop/yarn/* mapreduce.reduce.env HADOOP_MAPRED_HOME=/home/hadoop-3.1.4/etc/hadoop:/home/hadoop-3.1.4/share/hadoop/common/lib/*:/home/hadoop-3.1.4/share/hadoop/common/*:/home/hadoop-3.1.4/share/hadoop/hdfs:/home/hadoop-3.1.4/share/hadoop/hdfs/lib/*:/home/hadoop-3.1.4/share/hadoop/hdfs/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/lib/*:/home/hadoop-3.1.4/share/hadoop/mapreduce/*:/home/hadoop-3.1.4/share/hadoop/yarn:/home/hadoop-3.1.4/share/hadoop/yarn/lib/*:/home/hadoop-3.1.4/share/hadoop/yarn/* ``` 注意:上面的配置的value都是上面命令得到的值,复制到value中即可 如要知道我是怎么安装hadoop的,可以查看我这篇文章 [《安装Hadoop伪分布式模式教程,版本为Hadoop3.1.4》](http://www.classinstance.cn/detail/154.html "《安装Hadoop伪分布式模式教程,版本为Hadoop3.1.4》") hadoop 大数据分析 上一篇:安装Hadoop伪分布式模式教程,版本为Hadoop3.1.4 下一篇:bootstrap.yml配置报错:Could not resolve placeholder 'xx' in value
相关文章 安装Hadoop伪分布式模式教程,版本为Hadoop3.1.4(1138) 存算分离与存算一体的优缺点比较(5418) postgresql数据库表分区字段有必要创建索引么?(2008) postgresql主从复制时报错:no pg_hba.conf entry for replication connection from host "192.168.15.131", user "replicator", SSL off(6859) Parameter index out of range (1 > number of parameters, which is 0(1649) 推荐文章 spring cloud+feign+mybatis中使用seata0.9实现分布式事务(6774) spring cloud gateway报错Only one connection receive subscriber allowed(5161) spring cloud中Feign调用诡异报错MethodNotAllowed: status 405 reading(8598) elasticsearch7.1保存时报错: Validation Failed: 1: type is missing;(10699) 聊聊数据保存到MySQL后数据乱码的问题(1786) 使用spring4实现websocket连接(2823) jquery对象与dom对象互转(1658) linux使用epel源yum安装iftop、nload、nginx等(3619) linux下nginx安装其他模块(2330) solr时区设置解决时间多8小时问题(3017) 热门文章 存算分离与存算一体的优缺点比较(5418) hadoop运行mapreduce报错Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster(2802) 安装Hadoop伪分布式模式教程,版本为Hadoop3.1.4(1138) java stream去重的几种方式(40354) clickhouse如何删除数据(39444) clickhouse清空删除表数据(17847) redis报错远程主机强迫关闭了一个现有的连接以及超时问题(15844) the dependencies of some of the beans in the application context form a cycle(15583) clickhouse执行查询内存超出限制问题:Memory limit (total) exceeded(14205) CF由于网络原因连接服务器失败请重试 1033_10136(13160) 标签列表 java java基础 微服务 异常处理 mysql spring boot spring cloud clickhouse elasticsearch linux feign jdbc js spring postgresql docker nginx seata gateway maven solr hsqldb canal dubbo 数据库 redis 大数据分析 分布式事务 架构 quartz rocketmq select2 win10 mybatis jenkins html springmvc hadoop git 消息队列 websocket xheditor 分布式 zookeeper 小程序 开发工具 数据库集群 电脑 笔记 设计模式 阿里云 activemq ajax bat eclipse freemarker gitlab hibernate http hystrix javamail jquery jvm redission redission对象 springmail svn ubuntu ueditor