问题
I am trying to use JobControl
to connect multiple Mappers and Reducers together but encounter the following error when invoking JobConf.setMapperClass
:
setMapperClass(java.lang.Class<? extends org.apache.hadoop.mapred.Mapper>) in
org.apache.hadoop.mapred.JobConf cannot be applied to
(java.lang.Class<capture#530 of ? extends org.apache.hadoop.mapreduce.Mapper>)
It seems that java complains my implementation of Mapper, which is based on mapreduce.Mapper
, while JobControl takes mapred.Mapper
. (am I right on this part?)
Now my question is: should I keep using mapreduce.Mapper and give up JobControl and find something else to connect my jobs, or change my implementation to mapred.Mapper and keep using JobControl
. Is one of them considered depreciated?
回答1:
As discussed in the comments, the mapred
and mapreduce
packages are distinct from each other, with mapreduce
being the newer, cleaner one. The differences are further discussed on this post: hadoop.mapred vs hadoop.mapreduce?
So for your particular issue, it seems like you want to use org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl instead of org.apache.hadoop.mapred.jobcontrol.JobControl.
See also: Is it better to use the mapred or the mapreduce package to create a Hadoop Job?
来源:https://stackoverflow.com/questions/19307657/jobcontrol-and-jofconf-setmapperclass-error