IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster -> 正文阅读

[大数据]Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster

情景:mapreduce任务出现如下错误
错误:
Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
全过程:

[hadoop@hadoop102 ~]$ hadoop jar wc.jar com.muzhi.mapreduce.wordcount1.WordCountDriver /input /output
2021-08-21 10:53:30,543 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.220.103:8032
2021-08-21 10:53:31,430 WARN mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
2021-08-21 10:53:31,461 INFO mapreduce.JobResourceUploader: Disabling Erasure Coding for path: /tmp/hadoop-yarn/staging/hadoop/.staging/job_1629442479906_0002
2021-08-21 10:53:31,614 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
2021-08-21 10:53:31,823 INFO input.FileInputFormat: Total input files to process : 1
2021-08-21 10:53:31,878 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
2021-08-21 10:53:31,927 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
2021-08-21 10:53:31,961 INFO mapreduce.JobSubmitter: number of splits:1
2021-08-21 10:53:32,201 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
2021-08-21 10:53:32,272 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1629442479906_0002
2021-08-21 10:53:32,272 INFO mapreduce.JobSubmitter: Executing with tokens: []
2021-08-21 10:53:32,620 INFO conf.Configuration: resource-types.xml not found
2021-08-21 10:53:32,620 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'.
2021-08-21 10:53:32,712 INFO impl.YarnClientImpl: Submitted application application_1629442479906_0002
2021-08-21 10:53:32,774 INFO mapreduce.Job: The url to track the job: http://hadoop103:8088/proxy/application_1629442479906_0002/
2021-08-21 10:53:32,777 INFO mapreduce.Job: Running job: job_1629442479906_0002
2021-08-21 10:53:36,844 INFO mapreduce.Job: Job job_1629442479906_0002 running in uber mode : false
2021-08-21 10:53:36,847 INFO mapreduce.Job:  map 0% reduce 0%
2021-08-21 10:53:36,878 INFO mapreduce.Job: Job job_1629442479906_0002 failed with state FAILED due to: Application application_1629442479906_0002 failed 2 times due to AM Container for appattempt_1629442479906_0002_000002 exited with  exitCode: 1
Failing this attempt.Diagnostics: [2021-08-21 10:53:35.878]Exception from container-launch.
Container id: container_1629442479906_0002_02_000001
Exit code: 1

[2021-08-21 10:53:35.923]Container exited with a non-zero exit code 1. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
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:
<property>
  <name>yarn.app.mapreduce.am.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.map.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.reduce.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>

[2021-08-21 10:53:35.924]Container exited with a non-zero exit code 1. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
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:
<property>
  <name>yarn.app.mapreduce.am.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.map.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.reduce.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>

For more detailed output, check the application tracking page: http://hadoop103:8088/cluster/app/application_1629442479906_0002 Then click on links to logs of each attempt.
. Failing the application.
2021-08-21 10:53:36,929 INFO mapreduce.Job: Counters: 0
[hadoop@hadoop102 ~]$ 

解决办法:
1.在 mapred-site.xml 中如下内容

<property>
        <name>mapreduce.application.classpath</name>
        <value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*</value>
    </property>
    <property>
      <name>yarn.app.mapreduce.am.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>
    <property>
      <name>mapreduce.map.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>
    <property>
      <name>mapreduce.reduce.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>

2.还需在** mapred-site.xm**l 继续添加 yarn.application.classpath
查看:

[hadoop@hadoop102 hadoop-3.1.3]$ hadoop classpath
/opt/module/hadoop-3.1.3/etc/hadoop:/opt/module/hadoop-3.1.3/share/hadoop/common/lib/*:/opt/module/hadoop-3.1.3/share/hadoop/common/*:/opt/module/hadoop-3.1.3/share/hadoop/hdfs:/opt/module/hadoop-3.1.3/share/hadoop/hdfs/lib/*:/opt/module/hadoop-3.1.3/share/hadoop/hdfs/*:/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib/*:/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*:/opt/module/hadoop-3.1.3/share/hadoop/yarn:/opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*:/opt/module/hadoop-3.1.3/share/hadoop/yarn/*

把“:”改成“,”
结果如下

<property>
    <name>yarn.application.classpath</name>
    <value>/opt/module/hadoop-3.1.3/etc/hadoop,
    /opt/module/hadoop-3.1.3/share/hadoop/common/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/common/*,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs/*,
    /opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn/*
    </value>
  </property>

总共需要添加的内容

<!--用于集群跑mr任务-->
    <property>
        <name>mapreduce.application.classpath</name>
        <value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*</value>
    </property>
    <property>
      <name>yarn.app.mapreduce.am.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>
    <property>
      <name>mapreduce.map.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>
    <property>
      <name>mapreduce.reduce.env</name>
      <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
    </property>
<property>
    <name>yarn.application.classpath</name>
    <value>/opt/module/hadoop-3.1.3/etc/hadoop,
    /opt/module/hadoop-3.1.3/share/hadoop/common/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/common/*,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/hdfs/*,
    /opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*,
    /opt/module/hadoop-3.1.3/share/hadoop/yarn/*
    </value>
  </property>
  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2021-08-22 13:36:15  更:2021-08-22 13:37:43 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年10日历 -2024/10/31 1:21:35-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码