线程" main"中的例外情况java.lang.AbstractMethodError

时间:2016-07-07 04:42:52

标签: scala spark-graphx

我正在尝试访问spark GRAPHX。 我试过以下代码:

/**
  * Created by xyz on 5/7/16.
  */

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.graphx._



object simple {

  def main(args: Array[String]) {


    val conf = new SparkConf().setAppName("untitled1")
    val sc = new SparkContext(conf)

    val graph = GraphLoader.edgeListFile(sc, "graphx/data/followers.txt", true).partitionBy(PartitionStrategy.RandomVertexCut)
    val triCounts = graph.triangleCount().vertices
    val users = sc.textFile("graphx/data/users.txt").map { line =>
      val fields = line.split(",")
      (fields(0).toLong, fields(1))
    }
    val triCountByUsername = users.join(triCounts).map { case (id, (username, tc)) =>
      (username, tc)
    }
    println(triCountByUsername.collect().mkString("\n"))
  }
}

val conf = new SparkConf()。setAppName(" untitled1")     val sc = new SparkContext(conf)

val graph = GraphLoader.edgeListFile(sc, "graphx/data/followers.txt", true).partitionBy(PartitionStrategy.RandomVertexCut)
val triCounts = graph.triangleCount().vertices
val users = sc.textFile("graphx/data/users.txt").map { line =>
  val fields = line.split(",")
  (fields(0).toLong, fields(1))
}
val triCountByUsername = users.join(triCounts).map { case (id, (username, tc)) =>
  (username, tc)
}
println(triCountByUsername.collect().mkString("\n"))

========================================

但它给了我以下错误:

  

线程中的异常" main" java.lang.AbstractMethodError       在org.apache.spark.Logging $ class.log(Logging.scala:52)       在org.apache.spark.graphx.GraphLoader $ .log(GraphLoader.scala:26)       在org.apache.spark.Logging $ class.logInfo(Logging.scala:59)       在org.apache.spark.graphx.GraphLoader $ .logInfo(GraphLoader.scala:26)       在org.apache.spark.graphx.GraphLoader $ .edgeListFile(GraphLoader.scala:84)       在简单的$ .main(simple.scala:18)       在simple.main(simple.scala)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       at java.lang.reflect.Method.invoke(Method.java:498)       在com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

我有一个包含以下内容的数据文件:

  

2 1   4 1   1 2   6 3   7 3   7 6   6 7   3 7

0 个答案:

没有答案