hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashutosh Kumar <ashutosh....@gmail.com>
Subject Re: Error in using filecache
Date Fri, 20 Mar 2015 17:10:11 GMT
Path[] uris = context.getLocalCacheFiles(); works for me.

On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <kvandana1992@gmail.com>
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
>

Mime
View raw message