java.lang.IllegalArgumentException: Topic cannot be null. at org.apache.kafka.clients.producer.ProducerRecord.

I’m new to Kafka and struggling with a very strange error. Could someone please help in identifying the issue?

The error:

ERROR 26072 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Topic cannot be null.] with root cause

java.lang.IllegalArgumentException: Topic cannot be null.
    at org.apache.kafka.clients.producer.ProducerRecord.<init>(ProducerRecord.java:71) ~[kafka-clients-3.0.1.jar:na]

I’m suspecting that somehow it’s not able to read the Topic value from the application.yml file but not sure about the reason as it’s able to read all other values.

I’m uploading the entire code to Github.

Repo URL: github.com/vikram-bhardwaj/KafkaLearning.git

Please help.

Read more here: Source link