You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by kun yan <ya...@gmail.com> on 2013/09/16 04:18:20 UTC
SequenceFileReadDemo issue
Hi all when i read SequenceFIle occur exception
Exception in thread "main" java.lang.RuntimeException:
java.lang.NoSuchMethodException:
org.apache.hadoop.io.SequenceFile$Reader.<init>()
at
org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
at
com.yanbit.hadoop.filesystem.sequence.SequenceFileReadDemo.main(SequenceFileReadDemo.java:24)
Caused by: java.lang.NoSuchMethodException:
org.apache.hadoop.io.SequenceFile$Reader.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at
org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
... 1 more
follow is my source code
public class SequenceFileReadDemo {
public static void main(String[] args) throws IOException {
String uri = args[0];// /sequence/sequencefile
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://hydra0001:8020");
FileSystem fs = FileSystem.get(conf);
Path path = new Path(uri);
SequenceFile.Reader reader = null;
try {
reader = new SequenceFile.Reader(fs, path, conf);
Writable key = (Writable) ReflectionUtils.newInstance(
reader.getClass(), conf);
Writable value = (Writable) ReflectionUtils.newInstance(
reader.getValueClass(), conf);
long position = reader.getPosition();
while (reader.next(key,value)) {
String syncSeen = reader.syncSeen() ? "*" : "";
System.out.printf("[%s%s]\t%s\t%s\n", position, syncSeen, key,
value);
position = reader.getPosition(); // beginning of next record
}
} finally {
IOUtils.closeStream(reader);
}
}
}
--
In the Hadoop world, I am just a novice, explore the entire Hadoop
ecosystem, I hope one day I can contribute their own code
YanBit
yankunhadoop@gmail.com
Re: SequenceFileReadDemo issue
Posted by saurabh chhajed <sc...@gmail.com>.
Hi,
Can you look at this please, this might help you --
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java?view=markup
Thanks,
On Mon, Sep 16, 2013 at 7:48 AM, kun yan <ya...@gmail.com> wrote:
> Hi all when i read SequenceFIle occur exception
>
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
> at
> com.yanbit.hadoop.filesystem.sequence.SequenceFileReadDemo.main(SequenceFileReadDemo.java:24)
> Caused by: java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.getDeclaredConstructor(Unknown Source)
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
> ... 1 more
>
> follow is my source code
>
> public class SequenceFileReadDemo {
> public static void main(String[] args) throws IOException {
> String uri = args[0];// /sequence/sequencefile
> Configuration conf = new Configuration();
> conf.set("fs.defaultFS", "hdfs://hydra0001:8020");
> FileSystem fs = FileSystem.get(conf);
> Path path = new Path(uri);
> SequenceFile.Reader reader = null;
>
> try {
> reader = new SequenceFile.Reader(fs, path, conf);
> Writable key = (Writable) ReflectionUtils.newInstance(
> reader.getClass(), conf);
> Writable value = (Writable) ReflectionUtils.newInstance(
> reader.getValueClass(), conf);
> long position = reader.getPosition();
> while (reader.next(key,value)) {
> String syncSeen = reader.syncSeen() ? "*" : "";
> System.out.printf("[%s%s]\t%s\t%s\n", position, syncSeen, key,
> value);
> position = reader.getPosition(); // beginning of next record
> }
> } finally {
> IOUtils.closeStream(reader);
> }
> }
> }
>
> --
>
> In the Hadoop world, I am just a novice, explore the entire Hadoop
> ecosystem, I hope one day I can contribute their own code
>
> YanBit
> yankunhadoop@gmail.com
>
>
Re: SequenceFileReadDemo issue
Posted by saurabh chhajed <sc...@gmail.com>.
Hi,
Can you look at this please, this might help you --
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java?view=markup
Thanks,
On Mon, Sep 16, 2013 at 7:48 AM, kun yan <ya...@gmail.com> wrote:
> Hi all when i read SequenceFIle occur exception
>
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
> at
> com.yanbit.hadoop.filesystem.sequence.SequenceFileReadDemo.main(SequenceFileReadDemo.java:24)
> Caused by: java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.getDeclaredConstructor(Unknown Source)
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
> ... 1 more
>
> follow is my source code
>
> public class SequenceFileReadDemo {
> public static void main(String[] args) throws IOException {
> String uri = args[0];// /sequence/sequencefile
> Configuration conf = new Configuration();
> conf.set("fs.defaultFS", "hdfs://hydra0001:8020");
> FileSystem fs = FileSystem.get(conf);
> Path path = new Path(uri);
> SequenceFile.Reader reader = null;
>
> try {
> reader = new SequenceFile.Reader(fs, path, conf);
> Writable key = (Writable) ReflectionUtils.newInstance(
> reader.getClass(), conf);
> Writable value = (Writable) ReflectionUtils.newInstance(
> reader.getValueClass(), conf);
> long position = reader.getPosition();
> while (reader.next(key,value)) {
> String syncSeen = reader.syncSeen() ? "*" : "";
> System.out.printf("[%s%s]\t%s\t%s\n", position, syncSeen, key,
> value);
> position = reader.getPosition(); // beginning of next record
> }
> } finally {
> IOUtils.closeStream(reader);
> }
> }
> }
>
> --
>
> In the Hadoop world, I am just a novice, explore the entire Hadoop
> ecosystem, I hope one day I can contribute their own code
>
> YanBit
> yankunhadoop@gmail.com
>
>
Re: SequenceFileReadDemo issue
Posted by saurabh chhajed <sc...@gmail.com>.
Hi,
Can you look at this please, this might help you --
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java?view=markup
Thanks,
On Mon, Sep 16, 2013 at 7:48 AM, kun yan <ya...@gmail.com> wrote:
> Hi all when i read SequenceFIle occur exception
>
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
> at
> com.yanbit.hadoop.filesystem.sequence.SequenceFileReadDemo.main(SequenceFileReadDemo.java:24)
> Caused by: java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.getDeclaredConstructor(Unknown Source)
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
> ... 1 more
>
> follow is my source code
>
> public class SequenceFileReadDemo {
> public static void main(String[] args) throws IOException {
> String uri = args[0];// /sequence/sequencefile
> Configuration conf = new Configuration();
> conf.set("fs.defaultFS", "hdfs://hydra0001:8020");
> FileSystem fs = FileSystem.get(conf);
> Path path = new Path(uri);
> SequenceFile.Reader reader = null;
>
> try {
> reader = new SequenceFile.Reader(fs, path, conf);
> Writable key = (Writable) ReflectionUtils.newInstance(
> reader.getClass(), conf);
> Writable value = (Writable) ReflectionUtils.newInstance(
> reader.getValueClass(), conf);
> long position = reader.getPosition();
> while (reader.next(key,value)) {
> String syncSeen = reader.syncSeen() ? "*" : "";
> System.out.printf("[%s%s]\t%s\t%s\n", position, syncSeen, key,
> value);
> position = reader.getPosition(); // beginning of next record
> }
> } finally {
> IOUtils.closeStream(reader);
> }
> }
> }
>
> --
>
> In the Hadoop world, I am just a novice, explore the entire Hadoop
> ecosystem, I hope one day I can contribute their own code
>
> YanBit
> yankunhadoop@gmail.com
>
>
Re: SequenceFileReadDemo issue
Posted by saurabh chhajed <sc...@gmail.com>.
Hi,
Can you look at this please, this might help you --
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java?view=markup
Thanks,
On Mon, Sep 16, 2013 at 7:48 AM, kun yan <ya...@gmail.com> wrote:
> Hi all when i read SequenceFIle occur exception
>
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
> at
> com.yanbit.hadoop.filesystem.sequence.SequenceFileReadDemo.main(SequenceFileReadDemo.java:24)
> Caused by: java.lang.NoSuchMethodException:
> org.apache.hadoop.io.SequenceFile$Reader.<init>()
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.getDeclaredConstructor(Unknown Source)
> at
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
> ... 1 more
>
> follow is my source code
>
> public class SequenceFileReadDemo {
> public static void main(String[] args) throws IOException {
> String uri = args[0];// /sequence/sequencefile
> Configuration conf = new Configuration();
> conf.set("fs.defaultFS", "hdfs://hydra0001:8020");
> FileSystem fs = FileSystem.get(conf);
> Path path = new Path(uri);
> SequenceFile.Reader reader = null;
>
> try {
> reader = new SequenceFile.Reader(fs, path, conf);
> Writable key = (Writable) ReflectionUtils.newInstance(
> reader.getClass(), conf);
> Writable value = (Writable) ReflectionUtils.newInstance(
> reader.getValueClass(), conf);
> long position = reader.getPosition();
> while (reader.next(key,value)) {
> String syncSeen = reader.syncSeen() ? "*" : "";
> System.out.printf("[%s%s]\t%s\t%s\n", position, syncSeen, key,
> value);
> position = reader.getPosition(); // beginning of next record
> }
> } finally {
> IOUtils.closeStream(reader);
> }
> }
> }
>
> --
>
> In the Hadoop world, I am just a novice, explore the entire Hadoop
> ecosystem, I hope one day I can contribute their own code
>
> YanBit
> yankunhadoop@gmail.com
>
>