简体   繁体   English

尝试在 Windows 中启动 Zookeeper 时,“此时 log4j.properties 出乎意料”

[英]"log4j.properties was unexpected at this time" while trying to start Zookeeper in windows

I am using kafka stream download from Confluent ( http://www.confluent.io/product/kafka-streams/ ).我正在使用来自 Confluent ( http://www.confluent.io/product/kafka-streams/ ) 的 kafka 流下载。

I am following the instructions to run Zookeeper and Kafka on Windows.我正在按照说明在 Windows 上运行 Zookeeper 和 Kafka。 But while I try to start ZooKeeper using the command D:\\Softwares\\confluent-3.0.1\\bin\\windows>zookeeper-server-start.bat ./etc/kafka/zookeeper.properties , I get the error但是,当我尝试使用命令D:\\Softwares\\confluent-3.0.1\\bin\\windows>zookeeper-server-start.bat ./etc/kafka/zookeeper.properties启动 ZooKeeper 时,出现错误

D:\\Softwares\\confluent-3.0.1\\bin\\windows../../etc/kafka/log4j.properties was unexpected at this time. D:\\Softwares\\confluent-3.0.1\\bin\\windows../../etc/kafka/log4j.properties 这时候出乎意料。

If I check the "zookeeper-server-start.bat" file the commands look ok and is like below.There also exists log4j.properties file under directory confluent-3.0.1\\etc\\kafka如果我检查“zookeeper-server-start.bat”文件,命令看起来没问题,如下所示。在 confluent-3.0.1\\etc\\kafka 目录下也存在 log4j.properties 文件


IF [%1] EQU [] (
    echo USAGE: %0 zookeeper.properties
    EXIT /B 1
  )


SetLocal
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
    if exists %~dp0../../etc/kafka/log4j.properties (
        set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../etc/kafka/log4j.properties
    ) else (
        set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
    )
)

IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
    set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
)

%~dp0kafka-run-class.bat org.apache.zookeeper.server.quorum.QuorumPeerMain %*
EndLocal

I was getting same error when I placed kafka downloaded distribution in C:\\Program Files (x86) .当我将 kafka 下载的发行版放置在C:\\Program Files (x86)时,我遇到了同样的错误。 Moving kafka downloaded distribution to some other drive other then c drive worked for me.将 kafka 下载的发行版移动到其他驱动器,然后 c 驱动器对我有用。

Find below working commands: D:\\kafka_2.12-2.2.0\\kafka_2.12-2.2.0>bin\\windows\\zookeeper-server-start.bat config/zookeeper.properties找到以下工作命令: D:\\kafka_2.12-2.2.0\\kafka_2.12-2.2.0>bin\\windows\\zookeeper-server-start.bat config/zookeeper.properties

Kafka was downloaded from it's official site: Kafka 是从它的官方网站下载的:

https://kafka.apache.org/quickstart

https://github.com/renukaradhya/confluentplatform https://github.com/renukaradhya/confluentplatform

This above GIT repo contains modified windows batch scripts.上面的 GIT 存储库包含修改后的 Windows 批处理脚本。

You probably won't need this, but maybe someone else will have the same problem and this will help.您可能不需要这个,但也许其他人会遇到同样的问题,这会有所帮助。

What I've done to fix this was changing my console from Cmder to a normal windows cmd.我为解决这个问题所做的是将我的控制台从 Cmder 更改为普通的 Windows cmd。 Don't know how, but somehow it worked for me.不知道如何,但不知何故它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM