hadoop配置:无法加载或找到主类org.apache.hadoop

mrphzbgm  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(591)

我正在学习hadoop,我正在学习pluralsight的“hadoop的构建块”课程,我正在尝试通过伪分布式模式运行hadoop,当我运行以下命令时:
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.3.jar grep输入输出'dfs[a-z.]+'
我得到以下输出:

Application application_1530031734419_0001 failed 2 times due to AM Container for appattempt_1530031734419_0001_000002 exited with exitCode: 1
Failing this attempt.Diagnostics: [2018-06-26 16:50:21.067]Exception from container-launch.
Container id: container_1530031734419_0001_02_000001
Exit code: 1
[2018-06-26 16:50:21.076]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>
[2018-06-26 16:50:21.077]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://homestead:8088/cluster/app/application_1530031734419_0001 Then click on links to logs of each attempt.
. Failing the application.

我试着遵循这个日志,也搜索了类似的问题,基本上,似乎错误出现在一些配置文件中,所以它们是:
mapred-site.xml文件

<configuration>
        <property>
                <name>mapreduce.framework.name</name>
                <value>yarn</value>
        </property>
        <property>
                <name>yarn.app.mapreduce.am.env</name>
                <value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
        </property>
        <property>
                <name>mapreduce.map.env</name>
                <value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
        </property>
        <property>
                <name>mapreduce.reduce.env</name>
                <value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
        </property>
        <property>
                <name>mapreduce.application.classpath</name>
                <value>$HADOOP_MAPRED_HOME/,$HADOOP_MAPRED_HOME/lib/,$MR2_CLASS</value>
</property>
</configuration>

hadoop-env.sh//由于这个文件非常大,所以我只带来了我对默认文件所做的更改

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export HADOOP_HOME=~/hadoop-install/hadoop-3.0.3
export YARN_HOME=$HADOOP_HOME

另外:sbin/start-all.sh中的所有进程都在运行。操作系统是ubuntu,但在windows10计算机上通过虚拟机运行。hadoop版本是3.0.3

qpgpyjmq

qpgpyjmq1#

当它说 ${full path of your hadoop distribution directory} 1) 您需要确保hadoop集群中的每台机器上的路径都是相同的
2) 完整路径意味着没有 ~/ 在小路上

相关问题