Exception in thread "main" java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;

刘超 18天前 ⋅ 122 阅读   编辑

一、描述

  执行scala程序,报如下错误

Exception in thread "main" java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
	at org.apache.spark.util.Utils$.stringToSeq(Utils.scala:2664)
	at org.apache.spark.internal.config.ConfigHelpers$.stringToSeq(ConfigBuilder.scala:49)
	at org.apache.spark.internal.config.TypedConfigBuilder$$anonfun$toSequence$1.apply(ConfigBuilder.scala:125)
	at org.apache.spark.internal.config.TypedConfigBuilder$$anonfun$toSequence$1.apply(ConfigBuilder.scala:125)
	at org.apache.spark.internal.config.TypedConfigBuilder.createWithDefault(ConfigBuilder.scala:143)
	at org.apache.spark.internal.config.package$.(package.scala:172)
	at org.apache.spark.internal.config.package$.(package.scala)
	at org.apache.spark.SparkConf$.(SparkConf.scala:716)
	at org.apache.spark.SparkConf$.(SparkConf.scala)
	at org.apache.spark.SparkConf.set(SparkConf.scala:95)
	at org.apache.spark.SparkConf.set(SparkConf.scala:84)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7$$anonfun$apply$6.apply(SparkSession.scala:928)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7$$anonfun$apply$6.apply(SparkSession.scala:928)
	at scala.collection.mutable.HashMap.$anonfun$foreach$1(HashMap.scala:138)
	at scala.collection.mutable.HashTable.foreachEntry(HashTable.scala:236)
	at scala.collection.mutable.HashTable.foreachEntry$(HashTable.scala:229)
	at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
	at scala.collection.mutable.HashMap.foreach(HashMap.scala:138)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:928)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:926)
	at scala.Option.getOrElse(Option.scala:121)
	at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:926)
	at net.itdiandi.batch.spark.checkout.CheckPointDemo$.main(CheckPointDemo.scala:7)
	at net.itdiandi.batch.spark.checkout.CheckPointDemo.main(CheckPointDemo.scala)

二、分析

  1、添加-verbose:class参数,打印如下信息

[Loaded scala.Predef$ from file:/D:/ProgramFiles/scala-2.12.2/lib/scala-library.jar]

  发现使用的是scala-2.12.2,正常应该是scala-2.11.8,更改为scala-2.11.8就正常了

三、解决方法

  改为scala-2.11.8就正常了


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: