处理错误:找到接口 org.apache.hadoop.mapreduce.TaskAttemptContext,但需要类 [英] Handling Error: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected

查看:26
本文介绍了处理错误:找到接口 org.apache.hadoop.mapreduce.TaskAttemptContext,但需要类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 CDH4 并使用新的 mapreduce API 编写了一个 MapReduce 应用程序.我已经针对 hadoop-core-1.0.3.jar 编译了它,当我在我的 Hadoop 集群上运行它时出现错误:

I am using CDH4 and have written a MapReduce application using the new mapreduce API. I have compiled it against hadoop-core-1.0.3.jar and when I run it on my Hadoop cluster I get the error:

错误:找到接口 org.apache.hadoop.mapreduce.TaskAttemptContext,但需要类

Error: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected

我参考了这个 StackOverflow 问题 似乎在谈论同样的问题.答案表明我们针对 Hadoop-core-2.X.jar 文件编译出代码,但我找不到类似的东西.

I referred to this StackOverflow question which seems to be talking about the same problem. The answer suggests that we compile out code against the Hadoop-core-2.X.jar file, but I am unable to find anything like that.

那么我该如何编译它才能让它在 CDH4 中完美运行.

So how do I compile it so that it runs flawlessly in CDH4.

推荐答案

我在上面问题中发布的链接中的答案要求针对 Hadoop 2.0 库进行编译.顺便提一下,在 Hadoop 1.0 之后,将使用两个(或更多)不同的 jar,而不是使用单个 Hadoop Core jar 进行编译.

The answer in the link I posted in the question above asked to compile against Hadoop 2.0 library. Incidentally the post Hadoop 1.0, instead of using one single Hadoop Core jar for compilation, two (or maybe more) different jars are to be used.

我用过:hadoop-common-2.0.2-alpha.jarhadoop-mapreduce-client-core-2.0.2-alpha.jar

I used: hadoop-common-2.0.2-alpha.jar hadoop-mapreduce-client-core-2.0.2-alpha.jar

用于编译我的代码,之后它运行良好,没有出现上述错误.

for compiling my code and after that it ran fine w/o giving the aforementioned error.

这篇关于处理错误:找到接口 org.apache.hadoop.mapreduce.TaskAttemptContext,但需要类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆