我是 CDH4 和 Hadoop 的新手。
我正在尝试运行 wordcountexample 并收到以下错误。您能否纠正我并让我知道问题所在:
WordCount.java:25: interface expected here
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:39: interface expected here
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:56: setMapperClass(java.lang.Class<? extends org.apache.hadoop.mapred.Mapper>) in org.apache.hadoop.mapred.JobConf cannot be applied to (java.lang.Class<WordCount.Map>)
conf.setMapperClass(Map.class);
^
WordCount.java:57: setCombinerClass(java.lang.Class<? extends org.apache.hadoop.mapred.Reducer>) in org.apache.hadoop.mapred.JobConf cannot be applied to (java.lang.Class<WordCount.Reduce>)
conf.setCombinerClass(Reduce.class);
^
WordCount.java:58: setReducerClass(java.lang.Class<? extends org.apache.hadoop.mapred.Reducer>) in org.apache.hadoop.mapred.JobConf cannot be applied to (java.lang.Class<WordCount.Reduce>)
conf.setReducerClass(Reduce.class);
^
WordCount.java:60: setInputFormat(java.lang.Class<? extends org.apache.hadoop.mapred.InputFormat>) in org.apache.hadoop.mapred.JobConf cannot be applied to (java.lang.Class<org.apache.hadoop.mapreduce.lib.input.TextInputFormat>)
conf.setInputFormat(TextInputFormat.class);
^
WordCount.java:63: cannot find symbol
symbol : method setInputPaths(org.apache.hadoop.mapred.JobConf,org.apache.hadoop.fs.Path)
location: class org.apache.hadoop.mapreduce.lib.input.FileInputFormat
FileInputFormat.setInputPaths(conf, new Path(args[0]));
^
WordCount.java:64: setOutputPath(org.apache.hadoop.mapreduce.Job,org.apache.hadoop.fs.Path) in org.apache.hadoop.mapreduce.lib.output.FileOutputFormat cannot be applied to (org.apache.hadoop.mapred.JobConf,org.apache.hadoop.fs.Path)
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
用于编译的命令:
javac -classpath /usr/lib/hadoop/*:/usr/lib/hadoop/client/* WordCount.java
程序是wordcountexample