Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6855

Kafka fails to start with Java 10 due to faulty Java version detection

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.1, 2.0.0
    • Component/s: core
    • Labels:
      None
    • Environment:
      Ubuntu 18.04
      Java 10

      Description

      After downloading fresh installations of ZooKeeper and Kafka, and then starting ZooKeeper and Kafka the way that is recommended on http://kafka.apache.org/documentation/#quickstart the following error message is shown:

      Unrecognized VM option 'PrintGCDateStamps'

      I found the error in the kafka-run-class.sh file, where the Java version is determined and put in the JAVA_MAJOR_VERSION variable. My Java runtime reports the version as openjdk version "10.0.1" 2018-04-17, which makes the JAVA_MAJOR_VERSION value be "10 2018-04-17" instead of just "10". That makes the subsequent if statement fail.

      I found the following line to fix the problem:

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

       

        Attachments

          Activity

            People

            • Assignee:
              ijuma Ismael Juma
              Reporter:
              atornblad Anders Tornblad
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: