I am writing a mapreduce program in which the String created in Main method has to be shared in Mapper class. This is using New mapreduce api. I coded properly and set the variable using configuration in main method as below.
Configuration conf = new Configuration();
Job job = new Job(conf);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmsss");
String date = sdf.format(new Date());
String ImagesDir = "/user/srini/images/"+ date;
conf.set("ImagesDir", ImagesDir);
and then I am picking the variable in Mapper class setup method as below. First created a variable in class as String OutputPath and then did the following in the setup.
Configuration conf = context.getConfiguration();
OutputPath = conf.get("ImagesDir");
and used this variable in map method. The problem is, the value in variable OutputPath is null all the time. I have tried this using JobConf in Old mapred API long back and it worked fine. Some how, its going wrong here. What could have been wrong. Please help me..