我正在使用Giraph开发算法。我在Hadoop 1.2.1上使用版本1.0.0 。
我是开发Giraph的新手,所以请保持温和;)
我的自定义作业分为三个包:
我使用内置的giraph-core jar作为参考在Eclipse中编程,然后将其导出到名为" customJob.jar"的另一个jar中。
以下是我在Hadoop中启动它的方法:
hadoop jar /opt/hadoop/lib/customJob.jar layout.customrVertex -vif
io.JSONLongDoubleFloatDoubleToMapVertexInputFormat -vip /users/hadoop/input/tiny_graph.txt
-of io.VertexIdAndPositionOutputFormat -op /users/hadoop/output/customJob -w 1
作业开始,它进入MapReduce阶段然后失败:
14/12/16 17:39:35 INFO job.GiraphJob: run: Since checkpointing is disabled (default), do not allow any task retries (setting mapred.map.max.attempts = 0, old value = 4)
14/12/16 17:39:37 INFO mapred.JobClient: Running job: job_201412161121_0025
14/12/16 17:39:38 INFO mapred.JobClient: map 0% reduce 0%
14/12/16 17:39:49 INFO mapred.JobClient: Job complete: job_201412161121_0025
14/12/16 17:39:49 INFO mapred.JobClient: Counters: 4
14/12/16 17:39:49 INFO mapred.JobClient: Job Counters
14/12/16 17:39:49 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=9487
14/12/16 17:39:49 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
14/12/16 17:39:49 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
14/12/16 17:39:49 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
对JobTracker的进一步调查显示,JobSetup失败,出现ClassNotFoundException错误:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: layout.customVertex
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:889)
at org.apache.giraph.conf.ClassConfOption.get(ClassConfOption.java:94)
at org.apache.giraph.conf.GiraphClasses.readFromConf(GiraphClasses.java:152)
at org.apache.giraph.conf.GiraphClasses.<init>(GiraphClasses.java:142)
at org.apache.giraph.conf.ImmutableClassesGiraphConfiguration.<init>(ImmutableClassesGiraphConfiguration.java:93)
at org.apache.giraph.bsp.BspOutputFormat.getOutputCommitter(BspOutputFormat.java:56)
at org.apache.hadoop.mapred.Task.initialize(Task.java:515)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: layout.customVertex
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:857)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:881)
... 12 more
Caused by: java.lang.ClassNotFoundException: layout.customVertex
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:810)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:855)
... 13 more
Hadoop配置是Giraph快速启动页面中建议的配置。
我将非常感谢您提出的任何帮助/建议:)
提前致谢!
答案 0 :(得分:0)
首先更改hadoop-env.sh并将jar文件添加到hadoop_classpath。 然后,使用-libjars(path-to-your-jar / jar_file.jar)添加对jar文件的引用