Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Apache Kafka server start

Tags:

apache-kafka

I have an issue with start the kafka server in windows

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

Error Message:

The syntax of the command is incorrect. Error: Could not find or load main class Files\IBM\WebSphere

Any idea?

like image 701
Pranesh Radhakrishnan Avatar asked Oct 27 '25 08:10

Pranesh Radhakrishnan


2 Answers

I recently faced the same issue. This happens when the host machine has already IBM MQ server installed, which adds few entries to the classpath and it takes precedence while starting kafka server.

You can confirm this by opening a command prompt and run echo %CLASSPATH%. If it returns something similar to the following, the issue is due to the presence of existing MQ installation; however editing environment variables to make kafka run will impact MQ instance.

D:\Runtimes\IBM\WebSphere MQ\java\lib\com.ibm.mqjms.jar;D:\Runtimes\IBM\WebSphere MQ\java\lib\com.ibm.mq.jar

To overcome the problem:

  1. Locate bin/windows/kafka-run-class.bat.
  2. Edit the file and add the following line in the beginning of the script
set CLASSPATH=""

Basically we are resetting the CLASSPATH before the Kakfa startup script attempts to generate the classpath from the Kakfa libraries.

I hope this will solve the issue.

like image 50
Prabhu Avatar answered Oct 30 '25 14:10

Prabhu


I hope I'm not too late. I had the same problem and none of the answers here helped, but I found the solution by myself! Here it is:

None of the .properties files had a string like C:\Program Files but it was in the environment variables! Here's the list that has the string C:\Program Files\IBM\WebSphere:

  • CLASSPATH "C:\Program Files\IBM\WebSphere MQ\java\lib\com.ibm.mqjms.jar;C:\Program Files\IBM\WebSphere MQ\java\lib\com.ibm.mq.jar"
  • INCLUDE "C:\Program Files\IBM\WebSphere MQ\tools\c\include;C:\Program Files\IBM\WebSphere MQ\tools\cplus\include" LIB "C:\Program Files\IBM\WebSphere MQ\tools\lib64;C:\Program Files\IBM\WebSphere MQ\tools\lib"
  • MQ_FILE_PATH "C:\Program Files\IBM\WebSphere MQ"
  • MQ_JAVA_INSTALL_PATH "C:\Program Files\IBM\WebSphere MQ\java"
  • MQ_JAVA_LIB_PATH "C:\Program Files\IBM\WebSphere MQ\java\lib64;C:\Program Files\IBM\WebSphere MQ\java\lib"
  • MQ_JRE_PATH "C:\Program Files\IBM\WebSphere MQ\java\jre"

So I deleted those variables and configured the server.properties log.dirs entry like they say in this page: http://grokbase.com/t/kafka/users/141ssv46gc/using-kafka-on-windows-file-path-problems ( log.dirs=\\tmp\\kafka-logs )

And now it works! I hope this can help someone more.

Regards.

like image 28
Pau Mascarell Avatar answered Oct 30 '25 13:10

Pau Mascarell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!