Flink java.lang.NoClassDefFoundError: org/apache/flink/api/common...
🏷️ Flink
在 IntelliJ IDEA 中右键 Scala 文件直接运行时报了如下错误(通过 sbt 命令是可以正常打包的):
txt
"C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" ...
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/serialization/DeserializationSchema
at octopus.ba.RabbitMQStreamWordCount.main(RabbitMQStreamWordCount.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.serialization.DeserializationSchema
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
解决办法
在 Run/Debug Configurations 中勾选 Include dependencies with "Provided" scope,保存之后再运行就好了。