我正在使用hadoop设计mapreduce作业。我决定创建一个自定义InputFormat。当我想在Hortonworks Sandbox上运行作业时,出现以下错误:
Error: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected
根据论坛上的某些主题(例如here),这是一个版本问题:在Hadoop 2.x中,TaskAttemptContext是一个接口,而不是一个类。
这是我的pom.xml文件:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>0.9.0-incubating</version>
<classifier>hadoop1</classifier>
</dependency>
</dependencies>
如果您有什么想法,谢谢您的帮助。
这可能意味着您是在比运行Hadoop的早期版本上编译代码的。
这可能与它有关...
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
您在这里有两个不同版本的Hadoop。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句