java – Hadoop:配置对象时出错

前端之家收集整理的这篇文章主要介绍了java – Hadoop:配置对象时出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试运行Terasort基准测试,我得到以下异常:
java.lang.RuntimeException: Error in configuring object
    at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
    at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
    at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
    at org.apache.hadoop.mapred.MapTask$OldOutputCollector.<init>(MapTask.java:573)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:435)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:371)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:259)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
    at org.apache.hadoop.mapred.Child.main(Child.java:253)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
    ... 10 more
Caused by: java.lang.IllegalArgumentException: can't read paritions file
    at org.apache.hadoop.examples.terasort.TeraSort$TotalOrderPartitioner.configure(TeraSort.java:213)
    ... 15 more
Caused by: java.io.FileNotFoundException: File _partition.lst does not exist.
    at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:371)
    at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245)
    at org.apache.hadoop.fs.FileSystem.getLength(FileSystem.java:720)
    at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1417)
    at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1412)
    at org.apache.hadoop.examples.terasort.TeraSort$TotalOrderPartitioner.readPartitions(TeraSort.java:153)
    at org.apache.hadoop.examples.terasort.TeraSort$TotalOrderPartitioner.configure(TeraSort.java:210)
    ... 15 more

TeraGen命令运行正常,并为TeraSort创建了输入文件.这是我的输入目录的列表:

bin/hadoop fs -ls /user/hadoop/terasort-input/Warning: Maximum heap size rounded up to 1024 MB
Found 5 items
-rw-r--r--   1 sqatest supergroup           0 2012-01-23 14:13 /user/hadoop/terasort-input/_SUCCESS
drwxr-xr-x   - sqatest supergroup           0 2012-01-23 13:30 /user/hadoop/terasort-input/_logs
-rw-r--r--   1 sqatest supergroup         129 2012-01-23 15:49 /user/hadoop/terasort-input/_partition.lst
-rw-r--r--   1 sqatest supergroup 50000000000 2012-01-23 13:30 /user/hadoop/terasort-input/part-00000
-rw-r--r--   1 sqatest supergroup 50000000000 2012-01-23 13:30 /user/hadoop/terasort-input/part-00001

这是我运行terasort的命令:

bin/hadoop jar hadoop-examples-0.20.203.0.jar terasort -libjars hadoop-examples-0.20.203.0.jar /user/hadoop/terasort-input /user/hadoop/terasort-output

我在输入目录中看到文件_partition.lst,我不明白为什么我得到FileNotFoundException.

我按照http://www.michael-noll.com/blog/2011/04/09/benchmarking-and-stress-testing-an-hadoop-cluster-with-terasort-testdfsio-nnbench-mrbench/提供的设置详细信息进行操作

解决方法

我按照以下方式工作:

我从我的hadoop基目录运行本地模式,hadoop-1.0.0下面有一个输入子目录,我得到了同样的错误.

我编辑了失败的java文件,让它记录路径而不是文件名,重建它(“ant binary”),然后重新编写它.它正在我运行的目录中查找该文件.我不知道它是在查看hadoop基础目录还是执行目录.

…所以我在运行terasort的目录中创建了一个符号链接,指向输入目录中的真实文件.

这是一个廉价的黑客,但它的工作原理.

- Tim.

猜你在找的Java相关文章