Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka Unrecognized VM option 'PrintGCDateStamps'

Tags:

I installed Kafka on a remote server, and when I tried to run

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

And I received an error

Unrecognized VM option 'PrintGCDateStamps' 

And the kafka server failed to start. This was not being run in a vm, and was being run directly on Ubuntu Server 16.04 with Java properly installed. Any way this can be corrected simply?

like image 542
Mitchell Tracy Avatar asked May 01 '16 18:05

Mitchell Tracy


Video Answer


1 Answers

Actually, Kafka works fine with newer versions of Java. I had the same problem, and found an error in the kafka/bin/kafka-run-class.sh script, where the Java version was incorrectly parsed.

This line grabs too much of the version string:

JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([^.-]*).*"/\1/p') 

This makes the if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] condition fail to identify the correct Java version, and adds some unsupported GC options.

Changing the line above to this solved my problem:

JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([^.-]*).*/\1/p') 

I have reported this as an issue with Kafka. The issue can be found here: https://issues.apache.org/jira/browse/KAFKA-6855

EDIT: There is a committed fix for this: https://github.com/apache/kafka/commit/e9f86c3085fa8b65e77072389e0dd147b744f117

like image 112
Anders Marzi Tornblad Avatar answered Oct 01 '22 06:10

Anders Marzi Tornblad