1、IDEA开发Flink报错scala.tools.reflect.ToolBoxError: reflective compilation has failed
2、错误日志
Exception in thread "main" java.util.concurrent.ExecutionException: scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot initialize the compiler due to java.lang.NoSuchMethodError: scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.erasedTypes_$eq(Z)V
3、解决办法
这是由于运行Flink时出现的反射错误,只需要在maven中引入scala的sdk依赖即可解决,我的scala版本为2.12.5,所以引入以下依赖,注意引入的依赖必须根据自己的scala版本来。
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>2.12.5</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.12.5</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.5</version>
</dependency>