Hi Harit You need to set the Key Type as well. If you are using different Data Type for Key and Values in your map output with respect to reduce output then you need to specify both.
//setting the map output data type classes
job.setMapOutputKeyClass(LongWritable.class);
job.setMapOutputValueClass(Text.class);
//setting the final reduce output data type classes
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
Regards
Bejoy KS
