java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction1$mcII$sp

报错信息:

Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction1$mcII$sp at com.henvealf.spark.learn.mapPartitonsTest$.main(mapPartitonsTest.scala:33) at com.henvealf.spark.learn.mapPartitonsTest.main(mapPartitonsTest.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) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:736) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) Caused by: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction1$mcII$sp ... 11 more Caused by: java.lang.ClassNotFoundException: scala.runtime.java8.JFunction1$mcII$sp at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 11 more

 

 

 

这是由于版本不匹配造成的: 
本地: Scala 2.12 
集群: Spark 2.11 Scala 2.11.8 
把本地的Scala 改成 2.11.8 重新打包, 记住要把原来的Scala 2.12 SDK 换成 Scala 2.11.8 SDK

 

备注:

除了修改Scala SDK的版本还需要修改pom.xml的版本号:

<properties>
<scala.version>2.11.8</scala.version>
</properties>

posted on 2017-10-03 23:09  antyi  阅读(3871)  评论(0编辑  收藏  举报

导航