Error: java: 无法访问org.apache.hadoop.mapred.JobConf 找不到org.apache.hadoop.mapred.JobConf的类文件

Error: 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包,下载即可。

    原文作者:MapReduce
    原文地址: https://www.cnblogs.com/ultimateWorld/p/10557514.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞