public class MyClass extends Configured implements Tool{
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
int res = ToolRunner.run(conf, new MyClass(), args);
System.exit(res);
}
@Override
public int run(String[] args) throws Exception {
// TODO Auto-generated method stub
Job job = new Job(conf, "");
job.setJarByClass(MyClass.class);
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(TwovalueWritable.class);
job.setOutputKeyClass(IntWritable.class);
job.setOutputValueClass(TwovalueWritable.class);
job.setMapperClass(Mapper.class);
job.setReducerClass(Reducer.class);
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
.........................
}
I am able to work without any errors. Please make sure that you are doing
the same code above.
On Mon, Sep 1, 2014 at 4:18 PM, rab ra <[email protected]> wrote:
> Hello
>
> I m having an issue in running one simple map reduce job.
> The portion of the code is below. It gives a warning that Hadoop command
> line parsing was not peformed.
> This occurs despite the class implements Tool interface. Any clue?
>
> public static void main(String[] args) throws Exception {
>
> try{
>
> int exitcode = ToolRunner.run(new Configuration(), new
> MyClass(), args);
>
> System.exit(exitcode);
>
> }
>
> catch(Exception e)
>
> {
>
> e.printStackTrace();
>
> }
>
> }
>
>
>
> @Override
>
> public int run(String[] args) throws Exception {
>
> JobConf conf = new JobConf(MyClass.class);
>
> System.out.println(args);
>
> FileInputFormat.addInputPath(conf, new Path("/smallInput"));
>
> conf.setInputFormat(CFNInputFormat.class);
>
> conf.setMapperClass(MyMapper.class);
>
> conf.setMapOutputKeyClass(Text.class);
>
> conf.setMapOutputValueClass(Text.class);
>
> FileOutputFormat.setOutputPath(conf, new Path("/TEST"));
>
> JobClient.runJob(conf);
>
> return 0;
>
--
*Thanks & Regards *
*Unmesha Sreeveni U.B*
*Hadoop, Bigdata Developer*
*Center for Cyber Security | Amrita Vishwa Vidyapeetham*
http://www.unmeshasreeveni.blogspot.in/