class java.lang.RuntimeException/error reading Scala signature of package.class: Scala signature package has wrong version

在用scala连接spark时,出现错误:

scalac: error while loading package, class file 'C:\Users\asus\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.13.7.jar(scala/reflect/package.class)' is broken
(class java.lang.RuntimeException/error reading Scala signature of package.class: Scala signature package has wrong version
expected: 5.0
found: 5.2 in package.class)

 

 是因为版本冲突的问题,编译器添加scala的sdk版本与pom文件的版本一致

 

打开File>>Project Structure>>Global Librarier 添加和pom文件一致的版本即可

 

 运行成功

 

 最后,,用的spark版本是3.0

posted @ 2021-12-21 22:19  小跳不磕脑袋  阅读(2414)  评论(0编辑  收藏  举报