Distributed Cache functionality

Hi, I tried to use Distributed Cache in Java MR program but it did not ran successfully.

Program:
Driver class:
DistributedCache.addCacheFile(new URI(“hdfs://nn01.itversity.com:8020/user/ahsan456/cache_files/designation.txt”),conf);

And in Mapper Class :slight_smile:
private HashMap<String,Double> desg_map = new HashMap<String, Double>() ;
@Override
protected void setup(Context context) throws IOException, InterruptedException {

    BufferedReader br  ;
    Path[] localFiles =  DistributedCache.getLocalCacheFiles(context.getConfiguration()) ;
    String record  ;

    for(Path path : localFiles){
        if(path.getName().trim().equalsIgnoreCase("designation.txt")){
            br = new BufferedReader(new FileReader(path.toString()));
            record = br.readLine();
            while(record != null){
                String[] data = record.split(",") ;
                desg_map.put(data[0],Double.parseDouble(data[1].trim()));
                record = br.readLine() ;
            }
        }
    }

}

Error: Null Pointer Exception in MyMapper at below line:
for(Path path : localFiles){

Am I using the correct URI scheme ? If not please let me know the correct uri for the same.
The file is on hdfs and accessible by the same uri :
hdfs://nn01.itversity.com:8020/user/ahsan456/cache_files/designation.txt

Please suggest!!