Question

I just downloaded Kafka 2.8.0 from Apache website, and I am trying to setup using the instructions given on the website. But when I try to start zookeper server, I am getting below error:

Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

My environment is Windows 7 64 bit. I tried to follow below e-mail chain: Apache Email Chain . But still it's having same issue. Can anyone guide me in this? As I am very new to this and couldn't find many information on Google/Apache Kafka email chain.

Was it helpful?

Solution

Run these commands from your Kafka root folder:

cd bin/windows

Then run Zookeper server:

zookeeper-server-start.bat ../../config/zookeeper.properties

Then run Kafka server:

kafka-server-start.bat ../../config/server.properties


The gotcha here is to run the .bat files from the /bin/windows folder, so after you run your servers with the steps above and want to follow up with the tutorial, make sure you are running the correct batch files to create topics and whatnot, e.g.:

Create a topic:

kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

List topics:

kafka-topics.bat --list --zookeeper localhost:2181

OTHER TIPS

This problem happened because you have downloaded wrong version of Kafka. On the official page

enter image description here

you have selected Source download. If you will download the binary, everything will work as expected.

I also got the same problem in Windows platform due to keeping the kafka_2.12-2.3.0 folder in the Program Files. I changed the Kafka directory from Program Files to C:\ drive root directory. It worked fine after executing the following commands:

First, go to the Kafka root folder:

cd C:\kafka_2.12-2.3.0

Run Zookeeper server:

bin\windows\zookeeper-server-start.bat config\zookeeper.properties

Then Run Kafka Server:

bin\windows\kafka-server-start.bat config\server.properties

Had the same error message even though I had the correct Kafka download for my Scala version.

It ended up I was running the non-windows sh file (needed to run the bat in the windows sub-folder) and was running from within the bin folder instead of the root. Moving up to the root Kafka folder and running from there appears to have worked.

C:\kafka_2.10-0.8.2.0>bin\windows\zookeeper-server-start.bat config\zookeeper.properties

I'm running on OS X and I found that having spaces anywhere in the path leading to my Kafka base directory led to this exact error message. Renaming things without spaces solved the problem with no other fix.

As an example, my Kafka install was sitting at /Users/me/Kafka Demo/kafka_2.11-0.9.0.1 which caused that error when I tried to start Zookeeper. All I did was rename things as /Users/me/KafkaDemo/kafka_2.11-0.9.0.1 and everything worked fine.

Just download the binary and follow the steps mentioned in below link. http://kafka.apache.org/07/quickstart.html

if you are facing errors like

Error: Could not find or load main class org.apache.zookeeper.server.quorum.Quorumpeermain

copy zookeeper.properties from config folder to bin folder and bin/windows folder.

Now start the like
server : run zookeeper-server-start.bat zookeeper.properties

from bin or bin/windows(if you are in window machine). It should work.

If you are still facing problem, below link would be helpful http://blog.anilot.tk/2014/08/06/Set-Up-Kafka-On-Windows/

Now try staring the Kafka server.

use the below command if you are using windows: Goto bin/windows and then run kafka-server-start.bat ../../config/server.properties

if you are trying from shell prompt, goto bin and run below command

kafka-server-start.bat ../config/server.properties 

**Make sure server.properties is present in the config folder

The solution for windows OS is to do the following:

  1. Download the binary version instead of the source version from the official website of Apache Kafka.
  2. Make sure the JAVA_HOME environment variable does not have a space in it (by default it is installed in Program files), follow the official installation documentation for this. https://docs.oracle.com/cd/E39271_01/general.300/eid_getting_started/src/tgs_install_jdk.html.
  3. Make sure the JRE path and KAFKA_HOME path do not have spaces in them as well.
  4. Run the zookeeper before starting Kafka.

I downloaded latest stable Kafka from Apache and instruction mentioned by Matheus Felipe worked as expected.

I downloaded binary option - Scala 2.11 @ http://kafka.apache.org/downloads

I had same problem used zookeeper-3.4.12. bin directory do not has .bat files and windows directory. Just exist .com and .sh files. .com contain operation zookeeper execute. As you can see, that has to find %JAVA%. So I just set JAVA=[my java.exe path]. And it works.

I used to meet the issue by running below cmd via git bash tool.

bin/zookeeper-server-start.sh config/zookeeper.properties

Solution: I switched to cygwin tool (http://cygwin.com/) to run the same cmd and I did not see the issue any more.

Yes, I too faced the same problem and tried this way which was suggested in some comments above,

First I had my Kafka in C:\Program Files, Then I moved the kafka_2.11-2.1.0 folder to C:\ directory and tried the following command and it worked

.\bin\windows\kafka-server-start.bat config\server.properties 

P.S - ran the zookeper server before starting kafka

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top