miro miro - 3 months ago 34
JSON Question

flink + Kafka + JSON

I'm trying to test a Flink program to read a JSON data that came from Kafka using this JSONKeyValueDeserializationSchema class. However my Intellij is not finding this class. I suspect that some Maven dependency is missing or I'm using the wrong ones.

My 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.

enter image description here

What am I doing wrong?

Thanks

Answer

You need to use the same Flink version across all your dependencies. Using this dependency section should fix the problems

<dependencies>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-java_2.11</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>
Comments