hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From himanshu chandola <himanshu_cool...@yahoo.com>
Subject reading sequence Files on local file system
Date Sat, 26 Dec 2009 08:20:55 GMT
Hi Everyone,
I was trying to read a Sequence File which i moved from HDFS to my local file system in a
java program. To do this i used SequenceFile.Reader. 

The following is the constructor for SequenceFile.Reader which generates an exception:

SequenceFile.Reader sfr = new SequenceFile.Reader(new LocalFileSystem(), new Path(inputFile),
new Configuration());

where inputFile is a path like /home/user/inputSeq.dat
and the exception:

Exception in thread "main" java.lang.NullPointerException
    at org.apache.hadoop.fs.FileSystem.getDefaultBlockSize(FileSystem.java:1270)
    at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:359)
    at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245)
    at org.apache.hadoop.fs.FileSystem.getLength(FileSystem.java:671)
    at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1417)
    at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1412)
    at TestSequenceR.main(TestSequenceR.java:12)

I packaged the program to read the sequence file into a jar and ran it as java -jar. I wanted
to avoid using hadoop for this since while reading the file I will have shared variables and
the file is not that big to merit using hadoop on a cluster for this step. 

So I feel I am missing something elementary on this. I thought just importing SequenceFile.Reader
would do the job for me but supposedly it does not. 

It would be great if someone could throw more light on this.

Thanks
H



      

Mime
View raw message