You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by Vandana kumari <kv...@gmail.com> on 2015/03/20 10:29:00 UTC
Error in using filecache
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
Re: Error in using filecache
Posted by Ashutosh Kumar <as...@gmail.com>.
Path[] uris = context.getLocalCacheFiles(); works for me.
On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <kv...@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
>
Re: Error in using filecache
Posted by Ashutosh Kumar <as...@gmail.com>.
Path[] uris = context.getLocalCacheFiles(); works for me.
On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <kv...@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
>
Re: Error in using filecache
Posted by Ashutosh Kumar <as...@gmail.com>.
Path[] uris = context.getLocalCacheFiles(); works for me.
On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <kv...@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
>
Re: Error in using filecache
Posted by Ashutosh Kumar <as...@gmail.com>.
Path[] uris = context.getLocalCacheFiles(); works for me.
On Fri, Mar 20, 2015 at 2:59 PM, Vandana kumari <kv...@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
>