Caused by: java.lang.ClassNotFoundException: scala.collection.GenTraversableOnce$class

Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
18/04/21 19:05:26 INFO SparkContext: Running Spark version 1.6.2
Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
at org.apache.spark.util.TimeStampedWeakValueHashMap.(TimeStampedWeakValueHashMap.scala:42)
at org.apache.spark.SparkContext.(SparkContext.scala:298)
at scala.demo2.JdbcRDD$.main(JdbcRDD.scala:16)
at scala.demo2.JdbcRDD.main(JdbcRDD.scala)
Caused by: java.lang.ClassNotFoundException: scala.collection.GenTraversableOnce$class
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

... 4 more

你需要确保 spark所使用的scala版本与你系统scala的版本一致

查看build.sbt:

  

复制代码
name := "ScalaSBT"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "1.6.1"
复制代码

 

你需要确保 spark所使用的scala版本与你系统scala的版本一致

 

你也可以这样:

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"





你可能感兴趣的:(spark)