启动kafka的时候 测试消息是否可以正常发送报错 java.net.UnknownHostException: home

俊俏的俊 发表于: 2021-02-04   最后更新时间: 2021-02-05 09:15:02   1,534 游览

启动kafka的时候,连接测试消息的时候报错了

[root@bogon bin]# ./kafka-console-producer.sh --broker-list localhost:9092 --topic cruise_topic
log4j:ERROR Could not read configuration file from URL [file://home/software/kafka_2.11-2.1.0/bin/../config/tools-log4j.properties].
java.net.UnknownHostException: home
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:196)
        at java.net.Socket.connect(Socket.java:606)
        at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:962)
        at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:924)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1019)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1005)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:311)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:417)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.slf4j.impl.Log4jLoggerFactory.<init>(Log4jLoggerFactory.java:66)
        at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
        at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
        at com.typesafe.scalalogging.Logger$.apply(Logger.scala:48)
        at kafka.utils.Log4jControllerRegistration$.<init>(Logging.scala:25)
        at kafka.utils.Log4jControllerRegistration$.<clinit>(Logging.scala)
        at kafka.utils.Logging$class.$init$(Logging.scala:47)
        at kafka.utils.CommandLineUtils$.<init>(CommandLineUtils.scala:26)
        at kafka.utils.CommandLineUtils$.<clinit>(CommandLineUtils.scala)
        at kafka.tools.ConsoleProducer$ProducerConfig.<init>(ConsoleProducer.scala:210)
        at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:41)
        at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)
log4j:ERROR Ignoring configuration file [file://home/software/kafka_2.11-2.1.0/bin/../config/tools-log4j.properties].
log4j:WARN No appenders could be found for logger (kafka.utils.Log4jControllerRegistration$).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

请教大佬这是什么问题

发表于 2021-02-04
添加评论

朋友你好,我也是遇到了这个问题,一直找不到解决办法,可以问一下你最后是怎么解决的吗

home解析不开,怀疑localhost有问题。
你试试

./kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic cruise_topic
俊俏的俊 -> 無名 3年前

非常感谢

你的答案

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