返回到文章

采纳

编辑于 2年前

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

kafka

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)