Except in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka consumer

Except in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka consumer

我遇到了以下错误

Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:823)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:664)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:645)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:625)
    at KConsumer.main(KConsumer.java:19)
Caused by: org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
    at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:88)
    at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:47)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:730)
    ... 4 more

您在 bootstrap.servers 属性 中缺少一个 s。尝试使用 org.apache.kafka.clients.consumer.ConsumerConfig class 来获取正确的属性名称。