0

我正在尝试构建 Giraph 中包含的 SimpleShortestPathsComputation 示例并从我的主目录中运行它。基本上,我只是想调整 SimpleShortestPaths 示例并毫不费力地运行它(不太确定最好的方法是什么)。我的方法如下:

SimpleShortestPathsComputaiton.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)

我不太确定我做错了什么。如果有人能指出我正确的方向,或者链接到一个资源来解释我想要完成的更简单的方法,我将不胜感激!

4

1 回答 1

3

如果你运行的是“快速启动”,其实和 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”。

于 2014-03-29T21:10:48.647 回答