The error message indicates that the topic named 'first' does not exist when it was expected to exist. This error is thrown by Kafka's TopicCommand class, specifically in the method ensureTopicExists.

To resolve this issue, you can manually create the topic named 'first' before trying to use it. You can use the Kafka command line tool kafka-topics.sh to create the topic. Here is an example command to create the 'first' topic with default settings:

kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic first

Make sure that the ZooKeeper connection string and port are correct for your Kafka setup. After creating the topic, you should be able to use it without encountering the IllegalArgumentException

kafka创建主题失败ERROR javalangIllegalArgumentException Topic first does not exist as expected	at kafkaadminTopicCommand$kafka$admin$TopicCommand$$ensureTopicExistsTopicCommandscala373

原文地址: http://www.cveoy.top/t/topic/h9Jn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录