<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Creating hive table to read data from kafka topics giving error &amp;quot;Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)&amp;quot; in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269519#M206895</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/69080"&gt;@yukti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You seems to be using OLD&amp;nbsp; "&lt;SPAN&gt;hive-metastore-0.9.0.jar" JAR file. When you are using it with "kafka-handler-3.1.0.3.1.0.0-78.jar" jar.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you see the mentioned class inside your JAR?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# javap -cp /PATH/TO/hive-metastore-0.9.0.jar  org.apache.hadoop.hive.metastore.DefaultHiveMetaHook&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As i see your Kafka JAR version as "kafka-handler-3.1.0.&lt;EM&gt;&lt;STRONG&gt;3.1.0.0-78&lt;/STRONG&gt;&lt;/EM&gt;.jar"&amp;nbsp; Which has a Dependency to . hive-exec module of the same version i guess.&amp;nbsp; Just try to look at the "kafka-handler-3.1.0.&lt;EM&gt;&lt;STRONG&gt;3.1.0.0-78&lt;/STRONG&gt;&lt;/EM&gt;.jar"/META-INF/maven/org.apache.hive/kafka-handler/pom.xml" . file and then you will see that it needs the same verison of hive-exec&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# grep 'hive-exec' -A2 META-INF/maven/org.apache.hive/kafka-handler/pom.xml 
      &amp;lt;artifactId&amp;gt;hive-exec&amp;lt;/artifactId&amp;gt;
      &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
      &amp;lt;version&amp;gt;${project.version}&amp;lt;/version&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So i guess you should be using the following JAR (if you are using HDP installation)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;/usr/hdp/current/hive-metastore/lib/hive-standalone-metastore-3.1.0.3.1.0.0-78.jar
OR
/usr/hdp/current/hive-metastore/lib/hive-exec-3.1.0.3.1.0.0-78.jar&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2019 03:54:12 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2019-09-02T03:54:12Z</dc:date>
    <item>
      <title>Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269518#M206894</link>
      <description>&lt;P&gt;I am trying to create hive table to read data from kafka topics.&lt;/P&gt;&lt;P&gt;I am using CDH 6.2.0.&lt;BR /&gt;I am adding the below jar before creating the table :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;kafka-handler-3.1.0.3.1.0.0-78.jar;&lt;BR /&gt;hive-serde-0.10.0.jar;&lt;BR /&gt;hive-metastore-0.9.0.jar;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;below is the create table statement:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;CREATE EXTERNAL TABLE kafka_table&lt;BR /&gt;&amp;nbsp; (`timestamp` timestamp , `page` string,&amp;nbsp; `newPage` boolean,&lt;BR /&gt;&amp;nbsp; added int, deleted bigint, delta double)&lt;BR /&gt;&amp;nbsp; STORED BY 'org.apache.hadoop.hive.kafka.KafkaStorageHandler'&lt;BR /&gt;&amp;nbsp; TBLPROPERTIES&lt;BR /&gt;&amp;nbsp; ("kafka.topic" = "topic-name", "kafka.bootstrap.servers"="hostname:9092");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;giving me below error:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.metastore.DefaultHiveMetaHook&lt;BR /&gt;org/apache/hadoop/hive/metastore/DefaultHiveMetaHook&lt;/P&gt;&lt;P&gt;Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 03:36:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269518#M206894</guid>
      <dc:creator>yukti</dc:creator>
      <dc:date>2019-09-02T03:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269519#M206895</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/69080"&gt;@yukti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You seems to be using OLD&amp;nbsp; "&lt;SPAN&gt;hive-metastore-0.9.0.jar" JAR file. When you are using it with "kafka-handler-3.1.0.3.1.0.0-78.jar" jar.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you see the mentioned class inside your JAR?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# javap -cp /PATH/TO/hive-metastore-0.9.0.jar  org.apache.hadoop.hive.metastore.DefaultHiveMetaHook&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As i see your Kafka JAR version as "kafka-handler-3.1.0.&lt;EM&gt;&lt;STRONG&gt;3.1.0.0-78&lt;/STRONG&gt;&lt;/EM&gt;.jar"&amp;nbsp; Which has a Dependency to . hive-exec module of the same version i guess.&amp;nbsp; Just try to look at the "kafka-handler-3.1.0.&lt;EM&gt;&lt;STRONG&gt;3.1.0.0-78&lt;/STRONG&gt;&lt;/EM&gt;.jar"/META-INF/maven/org.apache.hive/kafka-handler/pom.xml" . file and then you will see that it needs the same verison of hive-exec&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# grep 'hive-exec' -A2 META-INF/maven/org.apache.hive/kafka-handler/pom.xml 
      &amp;lt;artifactId&amp;gt;hive-exec&amp;lt;/artifactId&amp;gt;
      &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
      &amp;lt;version&amp;gt;${project.version}&amp;lt;/version&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So i guess you should be using the following JAR (if you are using HDP installation)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;/usr/hdp/current/hive-metastore/lib/hive-standalone-metastore-3.1.0.3.1.0.0-78.jar
OR
/usr/hdp/current/hive-metastore/lib/hive-exec-3.1.0.3.1.0.0-78.jar&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 03:54:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269519#M206895</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-09-02T03:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269520#M206896</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/69080"&gt;@yukti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You seems to be using incorrect version of "hive-exec" / "hive-metastore" JAR.&lt;/P&gt;&lt;P&gt;Can you please tell me from where did you get the 3.1.0.;0-78 version of JARs (as your Kafka jar version is&lt;SPAN&gt;"kafka-handler-3.1.0.3.1.0.0-78.jar" so looks like you might have downloaded that JAR from HDP 3.1 installation?&amp;nbsp; Is that correct?&amp;nbsp; If yes then can you also take the hive-metastore JAR of the same version and then try.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the difference here between "hive-metastore-3.1.0.3.1.0.0-78.jar" and "hive-metastore-0.9.0.jar" JARs. From my HDP 3.1 installation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# ls -l /usr/hdp/3.1.0.0-78/hive/lib/hive-metastore.jar
lrwxrwxrwx. 1 root root 35 Feb 22  2019 /usr/hdp/3.1.0.0-78/hive/lib/hive-metastore.jar -&amp;gt; hive-metastore-3.1.0.3.1.0.0-78.jar

# /usr/jdk64/jdk1.8.0_112/bin/javap -cp /usr/hdp/current/hive-metastore/lib/hive-standalone-metastore-3.1.0.3.1.0.0-78.jar org.apache.hadoop.hive.metastore.DefaultHiveMetaHook
Compiled from "DefaultHiveMetaHook.java"
public abstract class org.apache.hadoop.hive.metastore.DefaultHiveMetaHook implements org.apache.hadoop.hive.metastore.HiveMetaHook {
  public org.apache.hadoop.hive.metastore.DefaultHiveMetaHook();
  public abstract void commitInsertTable(org.apache.hadoop.hive.metastore.api.Table, boolean) throws org.apache.hadoop.hive.metastore.api.MetaException;
  public abstract void preInsertTable(org.apache.hadoop.hive.metastore.api.Table, boolean) throws org.apache.hadoop.hive.metastore.api.MetaException;
  public abstract void rollbackInsertTable(org.apache.hadoop.hive.metastore.api.Table, boolean) throws org.apache.hadoop.hive.metastore.api.MetaException;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;On the other have we can see that "hive-metastore-0.9.0.jar" jar does not contains that class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# /usr/jdk64/jdk1.8.0_112/bin/javap -cp /tmp/hive-metastore-0.9.0.jar org.apache.hadoop.hive.metastore.DefaultHiveMetaHook
Error: class not found: org.apache.hadoop.hive.metastore.DefaultHiveMetaHook&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your question is answered then, Please make sure to mark the answer as the accepted solution.&lt;BR /&gt;If you find a reply useful, say thanks by clicking on the thumbs up button.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 05:15:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269520#M206896</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-09-02T05:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269543#M206916</link>
      <description>&lt;P&gt;Hi jay,&lt;BR /&gt;&lt;BR /&gt;That issue get resolved but then I tried altering table it was giving me error:&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;hive&amp;gt; ALTER TABLE kafka_table SET TBLPROPERTIES ("kafka.serde.class"="org.apache.hadoop.hive.serde2.avro.AvroSerDe");&lt;BR /&gt;FAILED: SemanticException [Error 10134]: ALTER TABLE cannot be used for a non-native table kafka_table&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;So I dropped that table ad try creating a new one having below statements:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;BR /&gt;CREATE EXTERNAL TABLE kafka_t_avro&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (`timestamp` timestamp , `page` string,&amp;nbsp; `newPage` boolean,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; added int, deleted bigint, delta double)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; STORED BY 'org.apache.hadoop.hive.kafka.KafkaStorageHandler'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TBLPROPERTIES&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ("kafka.topic" = "topic-name",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; "kafka.bootstrap.servers"="hostname:9092",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; "kafka.serde.class"="org.apache.hadoop.hive.serde2.avro.AvroSerDe");&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;Itsi sgiving me below error:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: MetaException(message:java.lang.ClassNotFoundException Class org.apache.hadoop.hive.kafka.KafkaSerDe not found)&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:22:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269543#M206916</guid>
      <dc:creator>yukti</dc:creator>
      <dc:date>2019-09-02T10:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269544#M206917</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/69080"&gt;@yukti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good to know that your originally reported issue is resolved.&lt;/P&gt;&lt;P&gt;If your question is answered then, Please make sure to mark the answer as the accepted solution.&lt;BR /&gt;If you find a reply useful, say thanks by clicking on the thumbs up button.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the new error, It will be best of you open a separate Topic/Thread that way user of this thread will not get confused with different errors.&amp;nbsp; &amp;nbsp;The new error also looks like related to incorrect JAR version.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: MetaException(message:java.lang.ClassNotFoundException Class org.apache.hadoop.hive.kafka.KafkaSerDe not found)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:25:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269544#M206917</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-09-02T10:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269578#M206939</link>
      <description>&lt;P&gt;Thanks jay!!!&lt;BR /&gt;&lt;BR /&gt;I am starting a new thread.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 02:29:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/269578#M206939</guid>
      <dc:creator>yukti</dc:creator>
      <dc:date>2019-09-03T02:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table to read data from kafka topics giving error "Error: Error running query: java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/DefaultHiveMetaHook (state=,code=0)"</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/294643#M217368</link>
      <description>&lt;P&gt;Hello Friend ,&lt;/P&gt;&lt;P&gt;ow can i add the kafka-handler.jar&amp;nbsp; in cloudera cluster?? from the manager or i have to copy the jar t specific location? can you explain&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 19:19:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Creating-hive-table-to-read-data-from-kafka-topics-giving/m-p/294643#M217368</guid>
      <dc:creator>AmroSaleh</dc:creator>
      <dc:date>2020-04-23T19:19:28Z</dc:date>
    </item>
  </channel>
</rss>

