Reputation: 981
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);
}
This code is for executing two jobs in Map/reduce program serially, not in parellel. I uses different mappers and reducers for each job, so I defined two JobConf objects. Because I should use the output of the first job as the input of the second job, I defined second JobConf objects after 'JobClient.runJob(conf_idTitle);'.
However, I got an exception like below:
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
Why this error emerged? Thanks in advance.
Upvotes: 1
Views: 587
Reputation: 169
public JobConf(Configuration conf)
This constructor is commonly used when your application already has constructed a JobConf object and wants a copy to use for an alternate job. The configuration in conf is copied into the new JobConf object.
Upvotes: 1