public int run(String[] args) throws Exception {
/*****************Job for id-title mapping*******************/
JobConf conf_idTitle = new JobConf(PageRank.class);
conf_idTitle.setJobName("first_idTitleMapping");
...
FileInputFormat.setInputPaths(conf_idTitle, new Path(args[0]));
FileOutputFormat.setOutputPath(conf_idTitle, new Path(pathforIdTitle));
JobClient.runJob(conf_idTitle);
/*****************Job for linkgraph mapping*******************/
JobConf conf_linkgraph = new JobConf(PageRank.class);
conf_linkgraph.setJobName("second_linkgraphBuilding");
...
FileInputFormat.setInputPaths(conf_linkgraph, new Path(args[0]));
FileOutputFormat.setOutputPath(conf_linkgraph, new Path(pathforLinkgraph));
JobClient.runJob(conf_linkgraph);
return 0;
}
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new PageRank(), args);
System.exit(res);
}
此代码用于在 Map/reduce 程序中串行执行两个作业,而不是并行执行。我为每个作业使用不同的映射器和缩减器,所以我定义了两个 JobConf 对象。因为我应该使用第一个作业的输出作为第二个作业的输入,所以我在“JobClient.runJob(conf_idTitle);”之后定义了第二个 JobConf 对象。
但是,我遇到了如下异常:
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:387)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:325)
at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157)
at org.apache.hadoop.mapred.Child.main(Child.java:264)
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.jav
为什么会出现这个错误?提前致谢。