Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.11.12'
Asked Answered
U

9

29

I am not able to run a Apache Kafka service due to a failure while trying to start a Zookeeper instance. I have downloaded and tried it with all 3 availabe downloads at the official site. (binarys and source) When i try to start zookeeper with

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

I always get the same error message:

Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.11.12'

The same goes for (after starting a seperate zookeeper (not the build-in from kakfa) instance)

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

I have tried it under Ubuntu 17.04 and 18.04. When i try this on a virtual machine using Ubuntu 16.04 it works.

Unfortunatly, all i found regarding this problem, was for Windows. Thank you for any help.

Utile answered 6/5, 2018 at 8:58 Comment(3)
Is it resolved for you, cause I'm getting the same error, I'm using ubuntu 16.04Ferwerda
because of some issues with my machine i freshly set up Ubuntu and now after that it worked following the standard tutorialUtile
I had the same problem , I have resolved by downloading "Binary downloads" instead of "Source download" kafka.apache.org/downloads.htmlPedrick
U
46

In my case it has nothing to do with the binary or source cause both of them give that same "classpath is empty please build the project first" error. Its because there is a space in the path where kafka resides.

Updraft answered 2/8, 2018 at 4:1 Comment(4)
Please help to resolve this problem, I'm getting the same error, Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.11.12'Ferwerda
This is the correct answer. When I removed the space in the Kafka folder name. It was able to start up again. Thanks for sharing the solution!Tender
Just saved my life. I accidentally moved my kafka folder to another folder whose name has a space in between ('My Folder' for example). Moving the kafka folder back to the original place fixed the problem!Risinger
Thanks allot worked for me, the root folder of the path where i had copied Kafka had a space in its name. removing that fixed the zookeeper-server-start issue.Coffin
H
21

I had the same issue, the problem was I was downloading the source of Kafka. So to make my Kafka server run, I downloaded the Kafka binaries and it worked for me.

Kafka binaries: http://mirror.cc.columbia.edu/pub/software/apache/kafka/1.1.0/

Hubsher answered 14/5, 2018 at 7:45 Comment(1)
thank you but i already tried with the binaries (as mentioned in the first post) and got the same error. because of some issues with my machine i freshly set up Ubuntu and now it works.Utile
O
15

We need to download kafka-binary and not the source Download Binary from mirror http://mirrors.estointernet.in/apache/kafka/2.2.0/kafka_2.11-2.2.0.tgz

Onceover answered 3/4, 2019 at 21:11 Comment(1)
Go to kafka.apache.org/downloads and choose most suitable versionDole
M
4

Go to your terminal and run:

$ ./gradlew jar -PscalaVersion=2.11.12
Mittel answered 12/3, 2020 at 20:11 Comment(1)
this has to be executed inside de donwloaded folderJinajingle
S
4

I had the same issue. I solved it when removed the white spases from my folder name e.g "Kafka binary" -> "Kafka_binary".

Stomach answered 14/6, 2020 at 10:39 Comment(0)
A
4

I have the same message when I try bin/kafka-topic.sh.

It's just because you have a space in the full path.

Go to the folder and execute "pwd", in the path, you must change the white space of folder by an underscore or use camel case.

Amadeus answered 28/1, 2021 at 13:54 Comment(0)
P
2

I changed the path:

~/Documents/Formation/Moi/Big Data/Logiciels/kafka_2.12-2.4.1

to

~/Documents/Formation/Moi/Logiciels/kafka_binary

and it works (binary sources)

Portmanteau answered 28/3, 2020 at 10:57 Comment(0)
S
1

Try echo $CLASSPATH in the terminal, check if there is a Java in this system. Or maybe you need to install java

Sliding answered 13/12, 2018 at 10:30 Comment(2)
this should be a comment not an answer @Jacob JinBrattishing
This is more of a comment than an answerHeptarchy
K
0

Please check scala version installed in your system. It should be scalaVersion=2.11.12.

Otherwise Download the kafka binary with installed scala version.

Koziara answered 11/7, 2018 at 7:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.