Apache Flink: Kafka connector in Python streaming API, “Cannot load user class”

孤街浪徒 提交于 2019-12-01 10:36:22

You are using wrong Kafka consumer here. In your code, it is FlinkKafkaConsumer09, but the lib you are using is flink-connector-kafka-0.11_2.11-1.6.1.jar, which is for FlinkKafkaConsumer011. Try to replace FlinkKafkaConsumer09 with this FlinkKafkaConsumer011, or use the lib file flink-connector-kafka-0.9_2.11-1.6.1.jar instead of current one.

I guest the jar file may has built-in import or dependencies,so the three jar files isn't enough.As to how to find out java jar dependent relations,that is what java maven do. You can see the official website "project build setup" for help. In my case,i follow official java project setup,use "from org.apache.flink.streaming.connectors.kafka import FlinkKafkaConsumer" and add dependency " org.apache.flink
flink-clients_2.11
1.8.0 " to pom.xml,then i can output kafka records to stdout now with the Python API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!