Search code examples
hadoopapache-kafkaclouderacloudera-managercloudera-quickstart-vm

How to set JAVA_HOME Cloudera quickstart for Kafka and Zookeeper


I have added Kafka service to my Cloudera cluster and when i try to start it it fails with the following error

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/kafka/common/utils/KafkaThread : Unsupported major.minor version 52.0

Which i understand is due to different java version and Kafka requires 1.8 while cloudera Quickstart has built in 1.7. I have installed 1.8 but my cloudera is still picking up the 1.7 version. I have updated JAVA_HOME and path veriables Also updated .profile and .bashrc files.

Java --version on my terminal shows following output.

[root@quickstart default]# java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

but when i try to start the Kafka from cloudera Manager it shows following error. Kindly help.

enter image description here


Solution

  • Here is what you can do.

    Login to the terminal of your name node. Stop all the services

        service hadoop-hdfs-datanode stop
        service hadoop-hdfs-journalnode stop        
        service hadoop-hdfs-namenode stop        
        service hadoop-hdfs-secondarynamenode stop        
        service hadoop-httpfs stop        
        service hadoop-mapreduce-historyserver stop        
        service hadoop-yarn-nodemanager stop        
        service hadoop-yarn-proxyserver stop        
        service hadoop-yarn-resourcemanager stop        
        service hbase-master stop        
        service hbase-regionserver stop
        service hbase-rest stop
        service hbase-solr-indexer stop
        service hbase-thrift stop
        service hive-metastore stop
        service hive-server2 stop
        service impala-catalog stop
        service impala-server stop
        service impala-state-store stop
        service oozie stop
        service solr-server stop
        service spark-history-server stop
        service sqoop2-server stop
        service sqoop-metastore stop
        service zookeeper-server stop
    

    Stop Server and Agent

        service cloudera-scm-agent stop
        service cloudera-scm-server stop
    

    Then add following into /etc/bashrc

    export JAVA_HOME=/usr/jdk1.8.0_231
    export JRE_HOME=${JAVA_HOME}
    export JDK_HOME=${JAVA_HOME}
    export ANT_HOME=/usr/local/apache-ant/apache-ant-1.9.2
    export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4
    export PATH=/usr/local/firefox:/sbin:$JAVA_HOME/bin:$ANT_HOME/bin:$M2_HOME/bin:$PATH
    

    Then finally restart the services and and Cluster from Cloudera Manager.