문제

Giraph Incubator에서 가장 짧은 경로 예제를 실행하려고합니다 ( https://cwiki.apache.org/confluence/display/giraph/shortest+ paths ^ 샘플 ). 그러나 giraph-*-dependencies.jar 에서이 예제를 실행하는 대신 내 직접 Jar를 만들었습니다. 예제에 제시된대로 단일 작업 파일을 만들 때

를 얻었습니다.
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.test.giraph.Test$SimpleShortestPathsVertexInputFormat
.

SimpleSheShortEstPathSvertexOutPutFormat (SimpleSheShorTestPathSvertexOutputFormat)를 이동하여 파일을 구분하고 (SimpleSheSheShortEstPathSvertexInputFormat_v2, simpleShorTestPathSvertexOutFormat_v2); 클래스는 더 이상 정적 가 아닙니다. 이것은 SimpleSheShortestPathSvertexInputFormat_v2에 대해 찾을 수없는 클래스 문제를 해결했지만 SimpleSheShortEstPathSvertexOutputFormat_v2에 대해 동일한 오류가 발생합니다. 아래는 내 스택 추적입니다.

INFO mapred.JobClient: Running job: job_201205221101_0003
INFO mapred.JobClient:  map 0% reduce 0%
INFO mapred.JobClient: Task Id : attempt_201205221101_0003_m_000005_0, Status : FAILED
    java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.test.giraph.utils.SimpleShortestPathsVertexOutputFormat_v2
            at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:898)
            at org.apache.giraph.graph.BspUtils.getVertexOutputFormatClass(BspUtils.java:134)
            at org.apache.giraph.bsp.BspOutputFormat.getOutputCommitter(BspOutputFormat.java:56)
            at org.apache.hadoop.mapred.Task.initialize(Task.java:490)
            at org.apache.hadoop.mapred.MapTask.run(MapTask.java:352)
            at org.apache.hadoop.mapred.Child$4.run(Child.java:259)
            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:1059)
            at org.apache.hadoop.mapred.Child.main(Child.java:253)
    Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.test.giraph.utils.SimpleShortestPathsVertexOutputFormat_v2
            at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:866)
            at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:890)
            ... 9 more
.

나는 직업 항아리를 검사하고 모든 수업이 거기에 있습니다. 또한 의사 분산 모드에서 Hadoop 0.20.203을 사용하고 있습니다. 제가 출시하는 방식은 아래에 제시됩니다.

hadoop jar giraphJobs.jar org.test.giraph.Test -libjars /path/to/giraph-0.2-SNAPSHOT-jar-with-dependencies.jar /path/to/input /path/to/output 0 3
.

또한 giraph-* - dependencies.jar에 대한 hadoop_classpath를 정의했습니다. 문제없이 PageRankBenchmark 예제를 실행할 수 있으며 (giraph-*-* dependencies.jar에서 직접), 단락 경로 예제도 작동합니다 (giraph-* - dependencies.jar에서 직접). 다른 Hadoop 작업은 문제없이 작동합니다 ( "클러스터"가 올바르게 작동하는지 테스트하기 위해 읽은 곳에서는 읽습니다). 누구도 비슷한 문제를 해결합니까? 어떤 도움이 될 것입니다.


솔루션 (이와 같이 게시해서 미안하지만 몇 시간 더 많은 시간 동안 내 질문에 대답 할 수 없음)

이 문제를 해결하려면 작업 JAR을 -libjars에 추가해야했습니다 (Madeoop_classPath의 HADOOP_CLASSPATH에 대한 변경 사항 없음). 작업을 시작하는 명령은 이제 다음과 같습니다.

hadoop jar giraphJobs.jar org.test.giraph.Test -libjars /path/to/giraph-0.2-SNAPSHOT-jar-with-dependencies.jar,/path/to/job.jar /path/to/input /path/to/output 0 3
.

JAR 목록은 쉼표로 구분되어야합니다. 이것은 내 문제를 해결했지만. 나는 여전히 내 직업 항아리를 "classpath"매개 변수로 전달 해야하는 이유는 아직도 호기심을 가지고 있습니까? 누군가 가이 합리적인 뒤에 무엇이든지 설명 할 수 있습니까? 내가 이상한 것을 발견했을 때 (최소한 의지) JAR을 호출 한 다음 "CLASSPATH"jar로 다시 전달하십시오. 나는 그 설명에 대해 정말로 궁금합니다.

도움이 되었습니까?

해결책

문제에 대한 대안적인 프로그래밍 해결책을 발견했습니다. 다음과 같은 방법으로 run () 메소드를 수정해야합니다 -

...
@Override
public int run(String[] argArray) throws Exception {
    Preconditions.checkArgument(argArray.length == 4,
        "run: Must have 4 arguments <input path> <output path> " +
        "<source vertex id> <# of workers>");

    GiraphJob job = new GiraphJob(getConf(), getClass().getName());
    // This is the addition - it will make hadoop look for other classes in the same     jar that contains this class
    job.getInternalJob().setJarByClass(getClass());
    job.setVertexClass(getClass());
    ...
}
.

setjarbyclass ()는 Hadoop이 getclass ()가 반환 한 클래스가 포함 된 클래스를 포함하는 동일한 JAR에서 누락 된 클래스를 찾아냅니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top