FileNotFoundException but the file exists

320 views Asked by At

I'm getting this exception in Hadoop while trying to read file that was added to distributed cache, and the strange thing is that the file exists on the given location

java.io.FileNotFoundException: File does not exist: /tmp/hadoop-pera/mapred/local/taskTracker/distcache/-1517670662102870873_-1918892372_1898431787/localhost/work/output/temporalcentroids/centroids-iteration0-noOfClusters2/part-r-00000

I'm adding the file in before starting my job using

DistributedCache.addCacheFile(URI.create(args[2]), job.getConfiguration());

And I'm trying to read from the file from setup metod in my mapper using

DistributedCache.getLocalCacheFiles(conf);

As I said, I can confirm that the file is on the local system, but the exception is thrown.

I'm running the job in pseudo-distributed mode, on one computer.

Any ideas?

Thanks

1

There are 1 answers

0
p.magalhaes On

Can u post how you are reading the file?

If you are using the default file system, and the default is configured to be HDFS, propably it is the error. If you are trying to read the file from local file system you must use:

FileSystem.getLocal(context.getConfiguration())