问题描述
|
我正在使用eclipse编写mapreduce程序。我导入了hadoop库
(hadoop-0.13.0-core.jar)
我导入了Mapper类import org.apache.hadoop.mapred.Mapper;
没有错误,但是当我写这个程序时
其来源是http://developer.yahoo.com/hadoop/tutorial/module3.html
public class WordCountMapper extends MapReduceBase
implements Mapper<LongWritable,Text,IntWritable> {
private final IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(WritableComparable key,Writable value,OutputCollector output,Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer itr = new StringTokenizer(line.toLowerCase());
while(itr.hasMoretokens()) {
word.set(itr.nextToken());
output.collect(word,one);
}
}
}
它给我错误类型映射器不是通用的。它不可能是
参数化参数
解决方法
您需要使用Hadoop的0.19版本。 API中引入了一些更改,并且该代码确实适用于较新的版本。虽然不是0.20。