kafka报 java.nio.file.NoSuchFileException: config/consumer.properties

南~风 发表于: 2023-01-05   最后更新时间: 2023-01-05 17:14:43   127 游览

kafka鉴权根据下面操作

https://www.orchome.com/1960

./kafka-console-producer.sh --broker-list 192.168.4.24:9092 --topic laoguo --producer.config ../config/producer.properties 

/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic  laoguo --consumer.config config/consumer.properties

报错如下:

Exception in thread "main" java.nio.file.NoSuchFileException: config/consumer.properties
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.Files.newByteChannel(Files.java:361)
        at java.nio.file.Files.newByteChannel(Files.java:407)
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
        at java.nio.file.Files.newInputStream(Files.java:152)
        at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:560)
        at kafka.tools.ConsoleConsumer$ConsumerConfig.<init>(ConsoleConsumer.scala:290)
        at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:52)
        at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)
发表于 2023-01-05
添加评论

你这个报错是没找到config/consumer.properties这个配置文件。

用绝对路径或者:

/bin/kafka-console-consumer.sh ...省略

改成

bin/kafka-console-consumer.sh ...省略
南~风 -> 半兽人 24天前

./kafka-console-producer.sh --broker-list 192.168.4.24:9092 --topic laoguo1 --producer.config ../config/producer.properties

报错1:

[2023-01-09 17:02:26,053] ERROR Error when sending message to topic laoguo1 with key: null, value: 1 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for laoguo1-0: 1568 ms has passed since batch creation plus linger time

./kafka-console-consumer.sh --bootstrap-server 192.168.4.24:9092 --topic laoguo2 --consumer.config ../config/consumer.properties

报错

WARN The configuration 'zookeeper.connect' was supplied but isn't a known config. (org.apache.kafka.clients.consumer.ConsumerConfig)
[2023-01-09 17:16:44,094] WARN The configuration 'zookeeper.connection.timeout.ms' was supplied but isn't a known config. (org.apache.kafka.clients.consumer.ConsumerConfig)

大佬,这个是什么意思

半兽人 -> 南~风 24天前

地址都不通,报超时了,感觉你kafka服务都没起来。

你的答案

查看kafka相关的其他问题或提一个您自己的问题
提问