我在網上搜了不少資料html
說是zookeeper的問題,修改更改server.properties下的host.name,zookeeper.connect的localhost 爲ip地址 app
怎麼也無論用ui
後來就單獨建了一個項目,發現沒有問題。結論是jar包衝突,逐個刪除jar包 發現是log4j的版本過低,須要1.2.12以上的版本spa
最後問題解決日誌
總結:
code
1、其實這個問題能夠早點解決,可是因爲我沒有仔細看日誌,全部卡了我兩天的時間。以前都是隻看錯誤日誌,不看警告日誌server
log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties).htm
log4j:WARN Please initialize the log4j system properly.ip
SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_versionkafka
Exception in thread "main" kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
第2、公共jar包儘可能使用高版本的東西。
第3、kafka 要是用ip,localhost 可能沒數據