运行giraph作业时出现问题(classnotfoundexception)

ztyzrc3y  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(609)

我正在尝试构建giraph中包含的simpleshortestpathscomputation示例,并从我的主目录中运行它。基本上,我只是在尝试调整simpleshortestpaths示例,并毫不麻烦地运行它(不太确定最好的方法是什么)。我的做法如下:
SimpleShorteSpathScomputiton.java文件:

import org.apache.giraph.graph.BasicComputation;
......
import org.apache.log4j.Logger;
import java.io.IOException;
public class SimpleShortestPathsComputation extends BasicComputation<
    LongWritable, DoubleWritable, FloatWritable, DoubleWritable> { 
......

我这样做:

JCC = javac
JFLAGS = "-Xlint"
OUTPUT_CLASS="test"
CLASSPATH = $(HADOOP_HOME)/hadoop-core-0.20.203.0.jar:$(GIRAPH_HOME)/giraph-core/target/giraph-1.1.0-SNAPSHOT-for-hadoop-0.20.203.0-jar-with-dependencies.jar

default: SimpleShortestPathsComputation.class

SimpleShortestPathsComputation.class: SimpleShortestPathsComputation.java
mkdir -p $(OUTPUT_CLASS)
$(JCC) $(JFLAGS) -classpath $(CLASSPATH) -d $(OUTPUT_CLASS)    SimpleShortestPathsComputation.java
jar cvf SimpleShortestPathsComputation.jar -C $(OUTPUT_CLASS)/ .

这很好,我创建了一个名为simpleshortestpathscomputation的jar文件。然后我试着这样运行:

$HADOOP_HOME/bin/hadoop jar $GIRAPH_HOME/giraph-examples/target/giraph-examples-1.1.0-SNAPSHOT-for-hadoop-0.20.203.0-jar-with-dependencies.jar \
org.apache.giraph.GiraphRunner /home/hduser/SimpleShortestPathsComputation.jar \
-vif org.apache.giraph.io.formats.JsonLongDoubleFloatDoubleVertexInputFormat \
-vip /user/hduser/input/tiny_graph.txt \
-vof org.apache.giraph.io.formats.IdWithValueTextOutputFormat \
-op /user/hduser/output/shortestpaths -w 1 \
/

但是,这会导致以下结果:

Exception in thread "main" java.lang.ClassNotFoundException:   /home/hduser/SimpleShortestPathsComputation.jar
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at org.apache.giraph.utils.ConfigurationUtils.handleComputationClass(ConfigurationUtils.java:470)
at org.apache.giraph.utils.ConfigurationUtils.populateGiraphConfiguration(ConfigurationUtils.java:453)
at org.apache.giraph.utils.ConfigurationUtils.parseArgs(ConfigurationUtils.java:207)
at org.apache.giraph.GiraphRunner.run(GiraphRunner.java:74)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at org.apache.giraph.GiraphRunner.main(GiraphRunner.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

我不太清楚我做错了什么。如果有人能给我指出正确的方向,或者链接到一个资源,来解释一个更简单的方法,我会非常感激!

iecba09b

iecba09b1#

如果您正在运行“快速启动”,实际上与1.0.0不一致:
(1) 参数“-vof”应该是“.”的“-of”-vof”在1.1.0中引入(见giraph-774)。
(2) 在1.0.0中,不存在名为“org.apache.giraph.examples.simpleshortestpathscomputation”的类,将其更改为“org.apache.giraph.examples.simpleshortestpathsvertex”。

相关问题