java.lang.NoSuchMethodError: scala.collection.immutable.HashSet$.empty()Lscala/collection/immutable/HashSet;

2015-06-10 11:32:27   作者:MangoCool   来源:MangoCool

编写一个简单的Scala程序,打包上传在到Centos6.5系统下,在Standalone模式中,执行java命令:

java -cp Spark2Test.jar SparkPi

执行结果:

Exception in thread "main" java.lang.NoSuchMethodError:
scala.collection.immutable.HashSet$.empty()Lscala/collection/immutable/HashSet;
         at akka.actor.ActorCell$.<init>(ActorCell.scala:336)
         at akka.actor.ActorCell$.<clinit>(ActorCell.scala)
         at akka.actor.RootActorPath.$div(ActorPath.scala:159)
         at akka.actor.LocalActorRefProvider.<init>(ActorRefProvider.scala:464)
         at akka.remote.RemoteActorRefProvider.<init>(RemoteActorRefProvider.scala:124)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
         at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$2.apply(DynamicAccess.scala:78)
         at scala.util.Try$.apply(Try.scala:191)
         at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:73)
         at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84)
         at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84)
         at scala.util.Success.flatMap(Try.scala:230)
         at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84)
         at akka.actor.ActorSystemImpl.liftedTree1$1(ActorSystem.scala:584)
         at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:577)
         at akka.actor.ActorSystem$.apply(ActorSystem.scala:141)
         at akka.actor.ActorSystem$.apply(ActorSystem.scala:118)
         at org.apache.spark.util.AkkaUtils$.org$apache$spark$util$AkkaUtils$$doCreateActorSystem(AkkaUtils.scala:122)
         at org.apache.spark.util.AkkaUtils$$anonfun$1.apply(AkkaUtils.scala:55)
         at org.apache.spark.util.AkkaUtils$$anonfun$1.apply(AkkaUtils.scala:54)
         at org.apache.spark.util.Utils$$anonfun$startServiceOnPort$1.apply$mcVI$sp(Utils.scala:1837)
         at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:166)
         at org.apache.spark.util.Utils$.startServiceOnPort(Utils.scala:1828)
         at org.apache.spark.util.AkkaUtils$.createActorSystem(AkkaUtils.scala:57)
         at org.apache.spark.SparkEnv$.create(SparkEnv.scala:223)
         at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:163)
         at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:269)
         at org.apache.spark.SparkContext.<init>(SparkContext.scala:272)
         at SparkPi$.main(SparkPi.scala:9)
         at SparkPi.main(SparkPi.scala)

问题所在:Spark版本和Scala版本不兼容导致。

解决办法:将Scala换成与Spark相匹配的版本。Spark是1.3.x时,该Scala从2.11.x版本换成2.10.x版本。

标签: Spark Standalone Exception Scala Centos

分享:

上一篇java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries

下一篇java.lang.NumberFormatException: For input string: "local"

关于我

一个喜欢唱歌,热衷旅行,爱好电子产品的码农。没事,跟三五好友吼上几嗓子,约上几个背着行囊去露营或者宅在家里抱着孩子敲代码。

座右铭:当你的才华还撑不起你的野心的时候,你就应该静下心来学习,永不止步!

            人生之旅历途甚长,所争决不在一年半月,万不可因此着急失望,招精神之萎葸。


Copyright 芒果酷(mangocool.com) All rights reserved. 湘ICP备14019394号

免责声明:本网站部分文章转载其他媒体,意在为公众提供免费服务。如有信息侵犯了您的权益,可与本网站联系,本网站将尽快予以撤除。