2012-12-30 51 views
0

在inputformat中使用CombineFileInputFormatInput時,出現錯誤InstantiationException。Hadoop CombineFileInputFormatInput

Configuration conf = new Configuration(); 
conf.set("fs.default.name", "hdfs://master:54310"); 

Job job = new Job(conf, "WordCount"); 
job.setJarByClass(WordCount.class); 
job.setMapperClass(WordCountMapper.class); 
job.setReducerClass(WordCountReducer.class); 
job.setOutputKeyClass(Text.class); 
job.setOutputValueClass(IntWritable.class); 

job.setInputFormatClass(CombineFileInputFormat.class); 
job.setOutputFormatClass(TextOutputFormat.class); 

FileInputFormat.addInputPath(job, new Path("/user/hduser/CombineFileInputFormatInput")); 
FileOutputFormat.setOutputPath(job, new Path("/user/hduser/CombineFileInputFormatOutputNew2")); 

System.exit(job.waitForCompletion(true) ? 0 : 1); 
+0

你能找到我們這個異常的堆棧跟蹤嗎? – Amar

回答

2

CombineFileInputFormat是一個抽象類,必須擴展它並實現createRecordReader方法:

/** 
* This is not implemented yet. 
*/ 
public abstract RecordReader<K, V> createRecordReader(InputSplit split, 
    TaskAttemptContext context) throws IOException; 

,然後更換job.setInputFormatClass(..)電話與你的名字擴展類。