简体   繁体   English

flink + Kafka + JSON

[英]flink + Kafka + JSON

I'm trying to test a Flink program to read a JSON data that came from Kafka using this JSONKeyValueDeserializationSchema class. 我正在尝试测试Flink程序,以使用此JSONKeyValueDeserializationSchema类读取来自Kafka的JSON数据。 However my Intellij is not finding this class. 但是我的Intellij找不到此类。 I suspect that some Maven dependency is missing or I'm using the wrong ones. 我怀疑缺少某些Maven依赖项,或者我使用了错误的依赖项。

My pom.xml 我的pom.xml

    <dependencies>
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-java_2.11</artifactId>
        <version>0.10.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-streaming-java_2.11</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-clients_2.11</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-connector-kafka-0.9_2.11</artifactId>
        <version>1.0.0</version>
    </dependency>

</dependencies>

The image bellow shows my Intellij complaining. 下图显示了我的Intellij抱怨。

在此处输入图片说明

What am I doing wrong? 我究竟做错了什么?

Thanks 谢谢

You need to use the same Flink version across all your dependencies. 您需要在所有依赖项中使用相同的Flink版本。 Using this dependency section should fix the problems 使用此依赖项部分应解决问题

<dependencies>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-java</artifactId>
    <version>1.1.1</version>
</dependency>

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-java_2.11</artifactId>
    <version>1.1.1</version>
</dependency>

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-clients_2.11</artifactId>
    <version>1.1.1</version>
</dependency>

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-connector-kafka-0.9_2.11</artifactId>
    <version>1.1.1</version>
</dependency>

</dependencies>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM