"log4j.properties was unexpected at this time" while trying to start Zookeeper in windows
Asked Answered
K

3

5

I am using kafka stream download from Confluent (http://www.confluent.io/product/kafka-streams/).

I am following the instructions to run Zookeeper and Kafka on Windows. 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../../etc/kafka/log4j.properties was unexpected at this time.

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


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

Korikorie answered 19/9, 2016 at 9:21 Comment(8)
Have you tried it with backslashes?Ruthi
Yes I have tried with back slashes and no results.Korikorie
if exists --> if existEcclesiastical
same result with "if exist" alsoKorikorie
@Korikorie Have you changed them in the batch-file as well?Ruthi
I have changed it in the current batch file but there were forward slashes in kafka-run-class.bat file which is referred in the above file which was causing the problem.Korikorie
After changing in kafka-run-class.bat file. It worked. Thanks.Korikorie
@Renukaradhya, Can you please specify in detail, what changes have u done.. I am facing the same issue.Perloff
W
4

I was getting same error when I placed kafka downloaded distribution in C:\Program Files (x86). Moving kafka downloaded distribution to some other drive other then c drive worked for me.

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

Kafka was downloaded from it's official site:

https://kafka.apache.org/quickstart
Welton answered 16/4, 2019 at 4:26 Comment(0)
A
4

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. Don't know how, but somehow it worked for me.

Almeria answered 16/6, 2021 at 19:20 Comment(0)
K
0

https://github.com/renukaradhya/confluentplatform

This above GIT repo contains modified windows batch scripts.

Korikorie answered 23/9, 2016 at 6:45 Comment(1)
Could/have you PR'd those back into the main projects?Winthorpe

© 2022 - 2024 — McMap. All rights reserved.