首页 > 解决方案 > 错误图 X 引起:java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

问题描述

我一直在玩使用类,但是当我尝试实现它们时,我不断收到上面的错误。这是我的代码:

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

class EdgeProperties()
case class WriterWriterProperties(weight: String, edgeType: String) extends EdgeProperties
object GraphXAnalysis2 {

val edgeWeightedWriterWriterCollaborated = "in/Graphs/Graph4_WriterWriter/EdgesWeightedWriterWriter_writerscollaborated.csv"
    val vertexWriterWriter = "in/Graphs/Graph4_WriterWriter/Vertices.csv"
    val conf = new SparkConf().setAppName("Music Graph Application").setMaster("local[1]")
    val sc = new SparkContext(conf)

 val WriterWriter: RDD[(VertexId, String)] = sc.textFile(vertexWriterWriter).map {
      line =>
        val row = line.split(",")
        (row(0).toLong, row(2))
    }

val edgesWriterWriterCollaborated: RDD[Edge[EdgeProperties]] = sc.textFile(edgeWeightedWriterWriterCollaborated).map {
      line =>
        val row = line.split(",")
        Edge(row(0).toLong, row(1).toLong, WriterWriterProperties(row(2), row(3)): EdgeProperties)
    }

val graph4 = Graph(WriterWriter, edgesWriterWriterCollaborated)

我是错误地声明了课程,错误地使用了它还是将它放在了错误的位置?非常感谢你,因为我对此完全陌生。

标签: scalaapache-sparkspark-graphx

解决方案


推荐阅读