线程“main”中的异常java.lang.NoClassDefFoundError:IntelliJ

时间:2017-12-06 11:52:50

标签: scala apache-spark intellij-idea vector apache-spark-ml

我正在尝试使用IntellijIDEA中的线性回归在Spark ML中构建模型。

在拟合模型之前,我应该创建一个VectorAssemblerfeature

import org.apache.spark.ml.feature.VectorAssembler
import org.apache.spark.ml.linalg.Vectors

//creating features column
val assembler = new VectorAssembler()
  .setInputCols(Array("col4","col5","col6","col7"))
  .setOutputCol("features")
  

线程“main”中的异常java.lang.NoClassDefFoundError:   org / apache / spark / ml / feature / VectorAssembler at   energydata $ .main(energydata.scala:35)at   energydata.main(energydata.scala)引起:   抛出java.lang.ClassNotFoundException:   org.apache.spark.ml.feature.VectorAssembler at   java.net.URLClassLoader.findClass(URLClassLoader.java:381)at   java.lang.ClassLoader.loadClass(ClassLoader.java:424)at   sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:335)at at   java.lang.ClassLoader.loadClass(ClassLoader.java:357)... 2更多

但这会给Intellij带来错误。当我在火花壳中尝试相同时,它的工作原理。

任何人都可以建议我在哪里出错?

name := "hello"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.1.0"
libraryDependencies += "org.apache.spark" % "spark-sql_2.11" % "2.1.0"
libraryDependencies += "com.datastax.spark" %% "spark-cassandra-connector" % "2.0.6"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % "2.1.0" % "provided"

0 个答案:

没有答案