gpt4 book ai didi

java - Giraph:自定义作业上未找到类异常

转载 作者:可可西里 更新时间:2023-11-01 14:41:03 27 4
gpt4 key购买 nike

我正在使用 Giraph 开发算法。我在 Hadoop 1.2.1 上使用 1.0.0 版

我是开发 Giraph 的新手,所以请保持温和 ;)

我的自定义作业分为三个包:

  • io:包含输入和输出格式类
  • layout:包含 Vertex 类、Aggregator 类和 MasterCompute 类。
  • run:包含工具实现类。

我使用构建的 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

Job 开始,进入 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 快速入门页面中建议的配置。

如果您能提供任何帮助/建议,我将不胜感激:)

提前致谢!

最佳答案

首先更改hadoop-env.sh 并将jar 文件添加到hadoop_classpath。然后,使用 -libjars (path-to-your-jar/jar_file.jar) 添加对 jar 文件的引用

关于java - Giraph:自定义作业上未找到类异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27514421/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com