mapreduce程序运行时设置函数job.setMapperClass出错

sen_lin8350 2013-10-19 09:37:39
public class MaxTemperatureDriver extends Configured implements Tool{

@Override
public int run(String[] args) throws Exception {
// TODO Auto-generated method stub
if(args.length != 2){
System.err.printf("USAG:%s [generic option] <inpur> <output>\n" , getClass().getSimpleName());
ToolRunner.printGenericCommandUsage(System.err);
return -1;
}

Job job = new Job(new Configuration(), "Max temperature");

//JobConf jobconf = new JobConf(new Configuration());jobconf.setMapperClass(? extends DataJoinMapperBase.class).


job.setJarByClass(getClass());
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setMapperClass( MaxTemperatureMapper.class);
job.setCombinerClass(MaxTemperatureReducer.class);
job.setReducerClass(MaxTemperatureReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
return job.waitForCompletion(true) ? 0 : 1;
}


public static void main(String [] args) throws Exception{
int exitCode = ToolRunner.run(new MaxTemperatureDriver(),args);
System.exit(exitCode);
}

}

为什么会出现The method setMapperClass (class<?extends Mapper>) in the type Job is not applicable for the arguments (class<MaxTemperatureMapper>)
...全文
1505 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
神秘tiger 2014-04-14
  • 打赏
  • 举报
回复
这个MaxTemperatureMapper.class类必须是继承 org.apache.hadoop.mapreduce.Mapper才可以使用job.setMapperClass方法
神秘tiger 2014-04-14
  • 打赏
  • 举报
回复
我也遇到这个问题 围观中
撸大湿 2013-10-22
  • 打赏
  • 举报
回复
说好的MaxTemperatureMapper.class和MaxTemperatureReducer.class呢? 贴出完整代码包括package

20,808

社区成员

发帖
与我相关
我的任务
社区描述
Hadoop生态大数据交流社区,致力于有Hadoop,hive,Spark,Hbase,Flink,ClickHouse,Kafka,数据仓库,大数据集群运维技术分享和交流等。致力于收集优质的博客
社区管理员
  • 分布式计算/Hadoop社区
  • 涤生大数据
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧