Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses问题解决

问题描述:

在用MapReduce实现数据去重时遇到报错

Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses

除此之外还有:java.lang.NoClassDefFoundError;java.io.IOException: Cannot initialize Cluster.

问题解决:

这类问题都是由于MapReduce和hadoop的依赖没有导全,导入:

<dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>3.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>3.2.0</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>3.2.0</version>
    </dependency>

    <!--mapreduce-->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-core</artifactId>
      <version>3.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-common</artifactId>
      <version>3.2.0</version>
    </dependency>

至此,问题解决.

 

posted @ 2021-11-18 23:08  天岁  阅读(1185)  评论(1编辑  收藏  举报