I am trying to read a sequencefile in hadoop 2.0 but I am unable to achieve it. I am using the below code which works perfectly fine in hadoop 1.0. Please let me know if I am missing something wrt 2.0
Configuration conf = new Configuration();
try {
FileSystem fs = FileSystem.get(conf);
Path p = new Path("/Users/xxx/git/xxx/src/test/cntr-20140527104344-r-00172");
SequenceFile.Reader reader = new SequenceFile.Reader(fs,p,conf);
Writable key = (Writable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
I am getting the below error while trying to debug.
2014-05-28 23:30:31,567 WARN util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(52)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2014-05-28 23:30:31,572 INFO compress.CodecPool (CodecPool.java:getDecompressor(121)) - Got brand-new decompressor
java.io.EOFException
at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:264)
at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:254)
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:163)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:78)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:90)
at org.apache.hadoop.io.compress.GzipCodec$GzipInputStream$ResetableGZIPInputStream.<init>(GzipCodec.java:92)
at org.apache.hadoop.io.compress.GzipCodec$GzipInputStream.<init>(GzipCodec.java:101)
at org.apache.hadoop.io.compress.GzipCodec.createInputStream(GzipCodec.java:169)
at org.apache.hadoop.io.compress.GzipCodec.createInputStream(GzipCodec.java:179)
at org.apache.hadoop.io.SequenceFile$Reader.init(SequenceFile.java:1520)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1428)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1417)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1412)
at com.xxx.bis.social.feedbehavior.cdl.Debuger.testSpliter(Debuger.java:30)
Kindly help.
Note : Reading and Writing Sequencefile using Hadoop 2.0 Apis I referred this link. But it did not work.