SparkStreaming 异常:java.lang.NoSuchMethodError: scala.Predef scope()Lscala/xml/TopScope

SparkStreaming运行报错19/05/0522:35:18INFOSparkEnv:RegisteringOutputCommitCoordinatorExceptioninthread"main"java.lang.NoSuchMethodError:scala.Predef$.$scope()Lscala/xml/TopScope$;atorg.apache.spark.ui.job...

SparkStreaming 异常:java.lang.NoSuchMethodError: scala.Predef scope()Lscala/xml/TopScope

SparkStreaming运行报错�

19/05/05 22:35:18 INFO SparkEnv: Registering OutputCommitCoordinatorException in thread "main" java.lang.NoSuchMethodError: scala.Predef$.$scope()Lscala/xml/TopScope$; at org.apache.spark.ui.jobs.AllJobsPage.<init>(AllJobsPage.scala:39) at org.apache.spark.ui.jobs.JobsTab.<init>(JobsTab.scala:38) at org.apache.spark.ui.SparkUI.initialize(SparkUI.scala:65) at org.apache.spark.ui.SparkUI.<init>(SparkUI.scala:82) at org.apache.spark.ui.SparkUI$.create(SparkUI.scala:220) at org.apache.spark.ui.SparkUI$.createLiveUI(SparkUI.scala:162) at org.apache.spark.SparkContext.<init>(SparkContext.scala:452)

版本问题:

�之前将依赖写成了2.10 ,而我用的版本是2.11,修改解决

 <dependency><groupId>org.scala-lang.modules</groupId><artifactId>scala-xml_2.11</artifactId><version>1.2.0</version>  </dependency>  <dependency><groupId>org.scala-lang</groupId><artifactId>scala-library</artifactId><version>${scala.version}</version>  </dependency>  <dependency><groupId>org.apache.spark</groupId><artifactId>spark-core_2.11</artifactId><version>${spark.version}</version>  </dependency>  <dependency><groupId>org.apache.spark</groupId><artifactId>spark-sql_2.11</artifactId><version>${spark.version}</version>  </dependency>  <dependency><groupId>org.apache.spark</groupId><artifactId>spark-streaming_2.11</artifactId><version>${spark.version}</version><exclusions> <exclusion>  <artifactId>scala-library</artifactId>  <groupId>org.scala-lang</groupId> </exclusion></exclusions>  </dependency>  <dependency><groupId>org.scala-lang</groupId><artifactId>scala-library</artifactId><version>${scala.version}</version>  </dependency>  <dependency><groupId>org.apache.spark</groupId><artifactId>spark-core_2.11</artifactId><version>${spark.version}</version>  </dependency>

源文地址:https://www.guoxiongfei.cn/csdn/7580.html