3
votes

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?

4
Did the directory contain any blank space?amethystic
No it doesn't have anyPranesh Radhakrishnan
Did you use any Linux-like shell to run this command? Try to use the tool Windows ships with.amethystic

4 Answers

9
votes

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.

4
votes

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.

0
votes

The problem is that somewere (maybe in server.properties file) there is a path withot "" and also this path contains the string Files\IBM\WebSphere (i think it is "C:\Program Files\IBM\WebSphere"). As you can see this path contains whitespace, so you should quot this path. Just find this path and quot it and, i hope, it will help you.

0
votes

I was able to identify the root cause which was as suggested by Prabhu in his answer. Thanks Prabhu! The only change from his solution was that I set the class path (barring IBM MQ path) in the file kafka-server-start.bat instead of kafka-run-class.bat Because setting the classpath in the kafka-run-class.bat did not work! I donno why! If somebody could explain, that would be great. For starting the zookeeper also I followed the same way in zookeeper-server-start. This is for Kafka version: 2.11.-1.0.0 Hope this helps! Thanks!