ClassCastException在运行Flink时



我在使用flink-connector-kafka-0.9运行flink时要低于错误 连接器。

   Exception in thread "main" java.lang.ClassCastException: org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer cannot be cast to org.apache.flink.streaming.api.functions.source.SourceFunction
at com.dataartisans.ReadFromKafka.main(ReadFromKafka.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Initially I was able to fetch records from Kafka . But now getting the above error .

a FlinkKafkaProducer08不是源函数,而是接收器功能。生产者的任务是向卡夫卡发出元素。与此相反,FlinkKafkaConsumer08是读取KAFKA数据的源函数。

相关内容

  • 没有找到相关文章

最新更新