Question

The instructions for running kafka from the quick start page are not working for me.

http://kafka.apache.org/07/quickstart.html

Kafka builds fine

05:55:01/kafka-0.8.1-src:58 $sbt package
[info] Set current project to kafka-0-8-1-src (in build file:/shared/kafka-0.8.1-src/)
[info] Packaging /shared/kafka-0.8.1-src/target/scala-2.10/kafka-0-8-1-src_2.10-0.1-SNAPSHOT.jar ...
[info] Done packaging.
[success] Total time: 0 s, completed Apr 17, 2014 5:55:07 AM

But does not run fine..

05:55:07/kafka-0.8.1-src:59 $bin/zookeeper-server-start.sh config/zookeeper.properties
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/zookeeper/server/quorum/QuorumPeerMain
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.server.quorum.QuorumPeerMain
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Similar errors occur for kafka-server-start.sh and all the other scripts inside bin

Was it helpful?

Solution

You downloaded kafka-0.8.1-src.tgz from download page. The instructions on quickstart link are meant for Binary download . Download one from the Binary downloads section of http://kafka.apache.org/downloads.html page. Now try .It should work.
Or if you want to build from the src.tgz package you downloaded, then run ./gradlew jar. It will download all the required dependencies.

OTHER TIPS

I was facing same problem On Windows 10, What i have done is :

Don't download/install Zookeeper separately, download only kafka_2.12-1.1.0 (or higher version)

  1. Create temp folder , ( like this E:\DevApplications\kafka\temp)

  2. Open zookeeper.properties ( i have it @ E:\DevApplications\kafka\kafka_2.12-1.1.0\config)

  3. Update dataDir (for me : dataDir=E:/DevApplications/kafka/temp) Note the forward slash

  4. Open CMD and run zookeeper-server-start.bat with zookeeper.properties as second parameter like

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

  1. Once zookeeper is started start kafka server by typing

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

Hope this helps.

To add to the Chandra Kant solutions, if you have proxy connection in your network then please use the below command

./gradlew -Dhttp.proxyHost=<PROXY-HOST> -Dhttp.proxyPort=<PROXY-PORT> jar

Thanks @Chandra kant it helped me a lot

You can also reach this exception if you try starting Kafka 0.9.0.0 running a java version less than java 1.7. Set your $JAVA_HOME to 1.7 or above and make sure JAVA_HOME/bin is on your classpath.

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