Kafka service fails to start due to JAVA_HOME mismatch after JDK upgrade
search cancel

Kafka service fails to start due to JAVA_HOME mismatch after JDK upgrade

book

Article ID: 449321

calendar_today

Updated On:

Products

Network Observability CA Performance Management

Issue/Introduction

This article describes a scenario where Kafka and Zookeeper services fail to start following an automated operating system update that replaces or removes the existing Java Development Kit (JDK) version.

Symptoms:

  • Kafka services fail to start on one or more nodes in a cluster.
  • systemctl status netops-kafka shows a "failed" state with "exit-code".
  • Journal logs (journalctl -xe) contain errors indicating that the Java binary cannot be found: kafka-server-start.sh: line 353: /usr/lib/jvm/java-17-openjdk-####/bin/java: No such file or directory

Cause

 An automated JDK upgrade (e.g., from version 17.0.17 to 17.0.19) removed the older Java directory from the disk. The netops-kafka service files and answer.properties still reference the old path, causing a startup failure.

Resolution

To resolve this issue, update the Java path in the configuration files on all affected nodes:

  1. Identify the new Java path by running: ls -la /usr/lib/jvm/
  2. Edit the Kafka service file: vi /etc/systemd/system/netops-kafka.service Update the Environment="JAVA_HOME=..." line to point to the new path.
  3. Edit the Zookeeper service file: vi /etc/systemd/system/netops-kafka-zookeeper.service Update the Environment="JAVA_HOME=..." line to point to the new path.
  4. Update the answer properties file: vi /opt/CA/netops-kafka/config/answer.properties Update the javaHome= variable.
  5. Reload the systemd daemon: systemctl daemon-reload
  6. Restart the services: systemctl restart netops-kafka