Kafka + Flink 出现异常 java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/Des
Posted 苦行者的刀
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kafka + Flink 出现异常 java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/Des相关的知识,希望对你有一定的参考价值。
我在 IDEA 环境中调试 Kafka+Flink 自己编写的例子时
代码编译都是通过的,但是进行Debug调试时,出现如下异常;
java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/DeserializationSchema at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.apache.flink.streaming.util.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) ... 7 more Disconnected from the target VM, address: \'127.0.0.1:55548\', transport: \'socket\' Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" Process finished with exit code 1
该配置maven的,也配置了,该加的jar也加了。
死活就是无法DEBUG,启动报错,直接就不能启;
找了很久原因,最终找到了原因:
在 Run/ Edit Configurations 中勾选 Include dependencies with “Provided” scope,保存之后再运行就好了。
搞定。
以上是关于Kafka + Flink 出现异常 java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/Des的主要内容,如果未能解决你的问题,请参考以下文章