'Kafka in Eclipse

I am trying to use the code from a youtube tutorial to set up Kafka with Eclipse. The thing is I finally managed to set up the servers and the code, as far as my knowledge goes, seems fine to me. The problem is that I have to import files from Kafka to make the program work and it seems there has been a problem with the module dependencies. I already looked up some questions which told me to install new software which I did and it still does not work.

The code looks like this

import java.util.Properties;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;

public class Produce {

    public static void main(String [] args) {

        // properties for producer
        Properties props = new Properties();
        props.put("bootstrap.servers", "localhost:9092");
        props.put("key.serializer", "org.apache.kafka.common.serialization.IntegerSerializer");
        props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

        // create Producer
        Producer<Integer, String> producer = new KafkaProducer<Integer,String>(props);
        
        // send messages to my topic
        for(int i = 0; i < 1; i++) {
        ProducerRecord<Integer, String> producerRecord = new ProducerRecord<Integer, String>("Test Topic", i, "Test Message #" +  Integer.toString(i));
        producer.send(producerRecord);
        }
            
        // close Producer
        
        producer.close();
    }
    }

and the error message is this : Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for C:\Users\adria\kafka_2.13-3.1.0\libs\jackson-module-scala_2.13-2.12.3.jar Caused by: java.lang.IllegalArgumentException: jackson.module.scala.2.13: Invalid module name: '2' is not a Java identifier

I can understand somewhat but not enough to get anywhere near solving it. Thanks for the help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source