hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Buck <jbb...@gmail.com>
Subject Cannot open a RandomAccessFile in read mode on HDFS
Date Wed, 09 Jun 2010 03:07:20 GMT
I'm attempting to open a RandomAccessFile that is in HDFS for purely reading
purposes but I'm getting a FileNotFoundException.
I'm attaching a short Java program that tries to do the following:
1) read a local RandomAccessFile
2) read a File in hdfs
3) read a RandomAccessFile in hdfs (same file as step 2).

When step 3 attempts to open the file, the error is thrown. I'm attaching my
java program and here's the exception stack trace:

Opening local RandomAccessFile:/tmp/foo.txt
Opening remote File:file:/code/hadoop/hdfs_
Opening remote RandomAccessFile:file:/code/hadoop/hdfs_test/netcdf_input/
failed trying to open file:/code/hadoop/hdfs_test/netcdf_input/file1.nc
java.io.FileNotFoundException: file:/code/hadoop/hdfs_test/netcdf_input/
file1.nc (No such file or directory)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:98)
    at HDFSReadWrite.main(HDFSReadWrite.java:42)
Exception in thread "main" java.lang.NullPointerException
    at HDFSReadWrite.main(HDFSReadWrite.java:47)

Should this work? I can see why writing to a RandomAccessFile wouldn't work
but shouldn't it be possible to open and read it?
Would I have a shot of this working if I went to the git trunk instead of

-Joe Buck

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message