Map1 -> Reduce -> Map2 -> Reduce のように、別のいくつかのジョブと連鎖する Hadoop ジョブを作成しようとしています。私のクラスはすべて同じファイルに実装されています。最初のジョブで次のエラーが発生します。
java.lang.RuntimeException: Error in configuring object
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:354)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
... 5 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: work.graph.WorkGraph$Map1.<init>()
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115)
at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:34)
... 10 more
Caused by: java.lang.NoSuchMethodException: work.graph.WorkGraph$Map1.<init>()
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:109)
Hadoop: No such Method Exception alreadyを見ましたが、それでも問題は解決しませんでした。このエラーが発生する他の理由を知っている人はいますか?
編集:私のコードは次のようになります:
public class WorkGraph {
public static Hashmap dictionary = new Hashmap();
public static class Map1 extends MapReduceBase implements Mapper {
public void map {}
}
public static class Map2 extends MapReduceBase implements Mapper {
}
public static void main(String[] args) throws Exception {
JobConf job1 = new JobConf(WorkGraph.class);
job1.setJobName("WorkGraph1");
job1.setInputFormat(TextInputFormat.class);
job1.setOutputFormat(TextOutputFormat.class);
job1.setOutputKeyClass(Text.class);
job1.setOutputValueClass(Text.class);
job1.setMapperClass(Map1.class);
FileInputFormat.addInputPath(job1, new Path(args[0]));
FileOutputFormat.setOutputPath(job1, new Path(args[1] + "/map1"));
JobClient.runJob(job1);
}