开发者

The type Mapper is not generic, hadoop eclipse pluggin

I am using eclipse to write mapreduce program. I imported hadoop library (hadoop-0.13.0-core.jar)

I imported Mapper class import org.apache.hadoop.mapred.Mapper; there is no error in this but when I wrote this program source of this is http://developer.yahoo.com/hadoop/tut开发者_开发百科orial/module3.html

public class WordCountMapper extends MapReduceBase
    implements Mapper<LongWritable, Text, 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);
    }
  }
}

it gives me error The type Mapper is not generic; it cannot be parameterized with arguments


You need to use the version 0.19 of Hadoop. There have been some changes introduced in the API and that code does work with newer versions. Not 0.20 though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜