当前位置:   article > 正文

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnRuntimeException

caused by: java.lang.classnotfoundexception: org.apache.hadoop.yarn.exceptio

日志报错内容:Caused by:java.lang.ClassNotFoundException:org.apache.hadoop.yarn.exceptions.YarnRuntimeException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) … 7 more

本人初学hadoop,是按照尚硅谷的b站视频学习,也是按照尚硅谷的配置文档配置的yarn-site.sml等等,但是到我运行wordcount就报错。现把我修改的地方大家可以在做个对比(仅针对我修改的文档做对比,未修改的地方就按照尚硅谷的资料来配置)。

此处为尚硅谷的配置文档

1:yarn-site.xml

		                                            <configuration>
													 <!-- 指定 MR 走 shuffle -->
													 <property>
													 <name>yarn.nodemanager.aux-services</name>
													 <value>mapreduce_shuffle</value>
													 </property>
													 <!-- 指定 ResourceManager 的地址-->
													 <property>
													 <name>yarn.resourcemanager.hostname</name>
													 <value>hadoop103</value>
													 </property>
													 <!-- 环境变量的继承 -->
													 <property>
													 <name>yarn.nodemanager.env-whitelist</name>
													 
													<value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CO
													NF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAP
													RED_HOME</value>
													 </property>
													
													<!-- 开启日志聚集功能 -->
													<property>
													 <name>yarn.log-aggregation-enable</name>
													 <value>true</value>
													</property>
													<!-- 设置日志聚集服务器地址 -->
													<property> 
													 <name>yarn.log.server.url</name> 
													 <value>http://hadoop102:19888/jobhistory/logs</value>
													</property>
													<!-- 设置日志保留时间为 7 天 -->
													<property>
													 <name>yarn.log-aggregation.retain-seconds</name>
													 <value>604800</value>
													</property>
													</configuration>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

2:mapred-site.xml

											           <!-- 历史服务器端地址 -->
														<property>
														 <name>mapreduce.jobhistory.address</name>
														 <value>hadoop102:10020</value>
														</property>
														<!-- 历史服务器 web 端地址 -->
														<property>
														 <name>mapreduce.jobhistory.webapp.address</name>
														 <value>hadoop102:19888</value>
														</property>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
自行修改的地方

1:yarn-site.xml

<configuration>
<!-- 指定 MR 走 shuffle -->
<property>
	<name>yarn.nodemanager.aux-services</name>
	<value>mapreduce_shuffle</value>
</property>
<!-- 指定 ResourceManager 的地址-->
<property>
	<name>yarn.resourcemanager.hostname</name>
	<value>hadoop103</value>
</property>
<!-- 环境变量的继承 -->
<property>
<name>yarn.nodemanager.env-whitelist</name>
	<value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,
	CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
</property>													
<property>
	<name>yarn.application.classpath</name>
<value>
	$HADOOP_CONF_DIR,
	$HADOOP_COMMON_HOME/share/hadoop/common/*,
	$HADOOP_COMMON_HOME/share/hadoop/common/lib/*,
	$HADOOP_HDFS_HOME/share/hadoop/hdfs/*,
	$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*,
	$YARN_HOME/share/hadoop/yarn/*
	$YARN_HOME/share/hadoop/yarn/lib/*
	$YARN_HOME/share/hadoop/mapreduce/*,
	$YARN_HOME/share/hadoop/mapreduce/lib/*
	export HADOOP_MAPRED_HOME=$HADOOP_HOME
	export HADOOP_COMMON_HOME=$HADOOP_HOME
	export HADOOP_HDFS_HOME=$HADOOP_HOME
	export YARN_HOME=$HADOOP_HOME
	export HADOOP_YARN_HOME=$HADOOP_HOME
	export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
	export HDFS_CONF_DIR=$HADOOP_HOME/etc/hadoop
	export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
     </value>
</property>														
<property>
	<name>yarn.application.classpath</name>
<value>
	/opt/module/hadoop-3.1.3/etc/*,        
	/opt/module/hadoop-3.1.3/etc/hadoop/*,
	/opt/module/hadoop-3.1.3/lib/*,
	/opt/module/hadoop-3.1.3/share/hadoop/common/*,
	/opt/module/hadoop-3.1.3/share/hadoop/common/lib/*,
	/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*,
	/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib-examples/*,
	/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/yarn/*,
	/opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*
     </value>
</property>															
<!-- 开启日志聚集功能 -->
<property>
	<name>yarn.log-aggregation-enable</name>
	<value>true</value>
</property>
<!-- 设置日志聚集服务器地址 -->
<property> 
	<name>yarn.log.server.url</name> 
	<value>http://hadoop102:19888/jobhistory/logs</value>
</property>
<!-- 设置日志保留时间为 7 天 -->
<property>
	<name>yarn.log-aggregation.retain-seconds</name>
	<value>604800</value>
</property>
</configuration>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71

2:marped-site.xml

<configuration>
<!-- 指定 MapReduce 程序运行在 Yarn 上 -->
<property>
	<name>mapreduce.framework.name</name>
	<value>yarn</value>
</property>
<property>
	<name>yarn.app.mapreduce.am.env</name>
	<value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
</property> 
														           
<property>
<name>mapreduce.application.classpath</name>
       <value> 
	/opt/module/hadoop-3.1.3/etc/*,
	/opt/module/hadoop-3.1.3/etc/hadoop/*,
	/opt/module/hadoop-3.1.3/lib/*, 
	/opt/module/hadoop-3.1.3/share/hadoop/common/*,
	/opt/module/hadoop-3.1.3/share/hadoop/common/lib/*,
	/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*,
	/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib-examples/*,
	/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/yarn/*,
	/opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*,x
       </value>
</property>
<!-- 历史服务器端地址 -->
<property>
	<name>mapreduce.jobhistory.address</name>
	<value>hadoop102:10020</value>
	</property>
<!-- 历史服务器 web 端地址 -->
<property>
	<name>mapreduce.jobhistory.webapp.address</name>
	<value>hadoop102:19888</value>
</property>
</configuration>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

遇到同样问题的童鞋可以试一下,具体原因我也不懂。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/124488
推荐阅读
相关标签
  

闽ICP备14008679号