Path[] uris = context.getLocalCacheFiles(); works for me.
On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <[email protected]>
wrote:
> Hello all
>
> I am using hadoop 2.2.0 and there is problem in using filecache.
> *Following code is in driver class:*
>
> Configuration conf = new Configuration();
>
> Job job = Job.getInstance();
> job.addCacheFile(new URI(args[0]));
>
>
> *Following code is in setup() of Mapper class:*
> Configuration conf = context.getConfiguration();
>
> URI[] dataFile = context.getCacheFiles();
> try {
> String line;
> BufferedReader cacheReader = new BufferedReader(
> new FileReader(dataFile[0].toString()));
> try {
> while ((line = cacheReader.readLine()) != null) {
> System.out.println(line);
> }
> } finally {
> System.out.println("Error");
> cacheReader.close();
> }
> } catch (Exception e) {
> System.out.println("Error");
> e.printStackTrace();
> }
>
> And i am getting File not found exception. Same problem if i use
> DistributedCache.getLocalCacheFile().
>
>
>
> --
> Thanks and regards
> Vandana kumari
>