麻烦运行giraph作业(classnotfoundexception)

时间:2013-10-21 02:04:38

标签: java hadoop classnotfoundexception giraph

我正在尝试构建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)

我不太确定我做错了什么。如果有人能指出我正确的方向,或链接到一个解释我想要完成的更容易的方式的资源,我将非常感激!

1 个答案:

答案 0 :(得分:3)

如果您正在运行&#34; Quick start&#34;,实际上与1.0.0不一致:

(1)论证&#34; -vof&#34;应该是&#34; -of&#34;。 &#34; -vof&#34;在1.1.0中引入(见GIRAPH-774)。

(2)在1.0.0中,没有一个名为&#34; org.apache.giraph.examples.SimpleShortestPathsComputation&#34;的类,将其更改为&#34; org.apache.giraph .examples.SimpleShortestPathsVertex&#34;