Error:(37, 47) java: 无法访问org.apache.hadoop.mapred.JobConf 找不到org.apache.hadoop.mapred.JobConf的类文件
出现此异常,就是缺少相关的依赖包,你检查一下以下四个依赖包是否齐全:
hadoop-mapreduce-client-core-2.7.2.jar
hadoop-common-2.7.2.jar
hadoop-mapreduce-client-common-2.7.2.jar
hadoop-mapreduce-client-jobclient-2.7.2.jar
解决方案:
1.添加Maven依赖项,pom.xml
<dependencies> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-core</artifactId> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-common</artifactId> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-jobclient</artifactId> <version>2.7.2</version> </dependency> </dependencies>
2.手动下载jar
http://mvnrepository.com,用artifactId搜索对应的jar包,下载即可。
原文地址:https://www.cnblogs.com/ultimateWorld/p/10557514.html
时间: 2024-10-28 15:08:32