<?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 spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218134#M180035</link>
    <description>&lt;DIV&gt;&lt;P&gt;I am facing issue while initiating spark-sql session.&lt;/P&gt;&lt;P&gt;Initially when I initiated spark session only default database was visible (Not default database of Hive but same of Spark).&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;In order to view hive databases I copied hive-site.xml from hive-conf dir to spark-conf dir. After I copied hive-site.xml I am getting below error.&lt;/P&gt;&lt;PRE&gt;$ spark-sql
WARN HiveConf: HiveConf of name hive.tez.cartesian-product.enabled does not exist
WARN HiveConf: HiveConf of name hive.metastore.warehouse.external.dir does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.use.ssl does not exist
WARN HiveConf: HiveConf of name hive.heapsize does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.port does not exist
WARN HiveConf: HiveConf of name hive.materializedview.rewriting.incremental does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.cors.allowed.headers does not exist
WARN HiveConf: HiveConf of name hive.driver.parallel.compilation does not exist
WARN HiveConf: HiveConf of name hive.tez.bucket.pruning does not exist
WARN HiveConf: HiveConf of name hive.hook.proto.base-directory does not exist
WARN HiveConf: HiveConf of name hive.load.data.owner does not exist
WARN HiveConf: HiveConf of name hive.execution.mode does not exist
WARN HiveConf: HiveConf of name hive.service.metrics.codahale.reporter.classes does not exist
WARN HiveConf: HiveConf of name hive.strict.managed.tables does not exist
WARN HiveConf: HiveConf of name hive.create.as.insert.only does not exist
WARN HiveConf: HiveConf of name hive.optimize.dynamic.partition.hashjoin does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.enable.cors does not exist
WARN HiveConf: HiveConf of name hive.metastore.db.type does not exist
WARN HiveConf: HiveConf of name hive.txn.strict.locking.mode does not exist
WARN HiveConf: HiveConf of name hive.metastore.transactional.event.listeners does not exist
WARN HiveConf: HiveConf of name hive.tez.input.generate.consistent.splits does not exist
INFO metastore: Trying to connect to metastore with URI thrift://&amp;lt;host-name&amp;gt;:9083
INFO metastore: Connected to metastore.
INFO SessionState: Created local directory: /tmp/7b9d5455-e71a-4bd5-aa4b-385758b575a8_resources
INFO SessionState: Created HDFS directory: /tmp/hive/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8
INFO SessionState: Created local directory: /tmp/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8
INFO SessionState: Created HDFS directory: /tmp/hive/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8/_tmp_space.db
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:529)
        at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver$.main(SparkSQLCLIDriver.scala:133)
        at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.main(SparkSQLCLIDriver.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$runMain(SparkSubmit.scala:904)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.tez.dag.api.SessionNotRunning
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 13 more
INFO ShutdownHookManager: Shutdown hook called
INFO ShutdownHookManager: Deleting directory /tmp/spark-911cc8f5-f53b-4ae6-add3-0c745581bead
$&lt;/PRE&gt;&lt;P&gt;I am able to run pyspark and spark-shell session successfully and Hive databases are visible to me in pyspark/spark-shell session.&lt;/P&gt;&lt;P&gt;The error is related to tez and I confirmed that tez services are running fine. I am successfully able to access hive tables through hive2.&lt;/P&gt;&lt;P&gt;I am using HDP3.0 and for Hive execution engine is Tez (Map-Reduce has been removed).&lt;/P&gt;</description>
    <pubDate>Thu, 11 Oct 2018 15:58:46 GMT</pubDate>
    <dc:creator>er_sharma_shant</dc:creator>
    <dc:date>2018-10-11T15:58:46Z</dc:date>
    <item>
      <title>spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning</title>
      <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218134#M180035</link>
      <description>&lt;DIV&gt;&lt;P&gt;I am facing issue while initiating spark-sql session.&lt;/P&gt;&lt;P&gt;Initially when I initiated spark session only default database was visible (Not default database of Hive but same of Spark).&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;In order to view hive databases I copied hive-site.xml from hive-conf dir to spark-conf dir. After I copied hive-site.xml I am getting below error.&lt;/P&gt;&lt;PRE&gt;$ spark-sql
WARN HiveConf: HiveConf of name hive.tez.cartesian-product.enabled does not exist
WARN HiveConf: HiveConf of name hive.metastore.warehouse.external.dir does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.use.ssl does not exist
WARN HiveConf: HiveConf of name hive.heapsize does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.port does not exist
WARN HiveConf: HiveConf of name hive.materializedview.rewriting.incremental does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.cors.allowed.headers does not exist
WARN HiveConf: HiveConf of name hive.driver.parallel.compilation does not exist
WARN HiveConf: HiveConf of name hive.tez.bucket.pruning does not exist
WARN HiveConf: HiveConf of name hive.hook.proto.base-directory does not exist
WARN HiveConf: HiveConf of name hive.load.data.owner does not exist
WARN HiveConf: HiveConf of name hive.execution.mode does not exist
WARN HiveConf: HiveConf of name hive.service.metrics.codahale.reporter.classes does not exist
WARN HiveConf: HiveConf of name hive.strict.managed.tables does not exist
WARN HiveConf: HiveConf of name hive.create.as.insert.only does not exist
WARN HiveConf: HiveConf of name hive.optimize.dynamic.partition.hashjoin does not exist
WARN HiveConf: HiveConf of name hive.server2.webui.enable.cors does not exist
WARN HiveConf: HiveConf of name hive.metastore.db.type does not exist
WARN HiveConf: HiveConf of name hive.txn.strict.locking.mode does not exist
WARN HiveConf: HiveConf of name hive.metastore.transactional.event.listeners does not exist
WARN HiveConf: HiveConf of name hive.tez.input.generate.consistent.splits does not exist
INFO metastore: Trying to connect to metastore with URI thrift://&amp;lt;host-name&amp;gt;:9083
INFO metastore: Connected to metastore.
INFO SessionState: Created local directory: /tmp/7b9d5455-e71a-4bd5-aa4b-385758b575a8_resources
INFO SessionState: Created HDFS directory: /tmp/hive/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8
INFO SessionState: Created local directory: /tmp/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8
INFO SessionState: Created HDFS directory: /tmp/hive/spark/7b9d5455-e71a-4bd5-aa4b-385758b575a8/_tmp_space.db
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:529)
        at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver$.main(SparkSQLCLIDriver.scala:133)
        at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.main(SparkSQLCLIDriver.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$runMain(SparkSubmit.scala:904)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.tez.dag.api.SessionNotRunning
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 13 more
INFO ShutdownHookManager: Shutdown hook called
INFO ShutdownHookManager: Deleting directory /tmp/spark-911cc8f5-f53b-4ae6-add3-0c745581bead
$&lt;/PRE&gt;&lt;P&gt;I am able to run pyspark and spark-shell session successfully and Hive databases are visible to me in pyspark/spark-shell session.&lt;/P&gt;&lt;P&gt;The error is related to tez and I confirmed that tez services are running fine. I am successfully able to access hive tables through hive2.&lt;/P&gt;&lt;P&gt;I am using HDP3.0 and for Hive execution engine is Tez (Map-Reduce has been removed).&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 15:58:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218134#M180035</guid>
      <dc:creator>er_sharma_shant</dc:creator>
      <dc:date>2018-10-11T15:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning</title>
      <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218135#M180036</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/94251/ersharmashantanu.html" nodeid="94251"&gt;@Shantanu
 Sharma&lt;/A&gt; You should not copy the hive-site.xml from hive conf directory for spark. Spark uses a smaller and rather simple hive-site.xml. &lt;/P&gt;&lt;PRE&gt;cat /etc/spark2/conf/hive-site.xml

&amp;lt;configuration  xmlns:xi="http://www.w3.org/2001/XInclude"&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.exec.scratchdir&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;/tmp/spark&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.metastore.client.connect.retry.delay&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;5&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.metastore.client.socket.timeout&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;1800&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.metastore.uris&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;thrift://hive-trhift-fqdn:9083&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.server2.enable.doAs&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;false&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.server2.thrift.http.port&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;10002&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.server2.thrift.port&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;10016&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
      &amp;lt;name&amp;gt;hive.server2.transport.mode&amp;lt;/name&amp;gt;
      &amp;lt;value&amp;gt;binary&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/PRE&gt;&lt;P&gt;The above is an example, just make sure you change values accordingly to your env (hive.metastore.uris)&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 02:49:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218135#M180036</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-10-13T02:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning</title>
      <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218136#M180037</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/11048/falbani.html"&gt;Felix Albani&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If I don't copy hive-site.xml from hive conf directory for spark then I can't see Hive databases in spark(pyspark and spark-shell).&lt;/P&gt;&lt;P&gt;Could you please explain me what all properties I should add in hive-site.xml of saprk and where should I update hive.metastore.uris?&lt;/P&gt;&lt;P&gt;If I copy below property from hive conf to spark conf, will this work?&lt;/P&gt;&lt;P&gt;&lt;U&gt;Technical Stack Details:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;HDP3.0&lt;/P&gt;&lt;P&gt;Spark2.3&lt;/P&gt;&lt;P&gt;Hive3.1&lt;/P&gt;&lt;PRE&gt;&amp;lt;configuration&amp;gt;
  &amp;lt;property&amp;gt;
  &amp;lt;name&amp;gt;hive.metastore.uris&amp;lt;/name&amp;gt;
    &amp;lt;!-- hostname must point to the Hive metastore URI in your cluster --&amp;gt;
    &amp;lt;value&amp;gt;thrift://hostname:9083&amp;lt;/value&amp;gt;
    &amp;lt;description&amp;gt;URI for client to contact metastore server&amp;lt;/description&amp;gt;
  &amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Oct 2018 00:54:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218136#M180037</guid>
      <dc:creator>er_sharma_shant</dc:creator>
      <dc:date>2018-10-14T00:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning</title>
      <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218137#M180038</link>
      <description>&lt;P&gt;I copied /etc/hive/hive-site.xml from hive conf directory to /etc/spark2/ and then removed below properties from /etc/spark2/conf/hive-site.xml.&lt;/P&gt;&lt;P&gt;It's working now, I can see Hive databases in spark (pyspakr, spark-shell, spark-sql etc).&lt;/P&gt;&lt;PRE&gt;hive.tez.cartesian-product.enabled 
hive.metastore.warehouse.external.dir 
hive.server2.webui.use.ssl 
hive.heapsize 
hive.server2.webui.port 
hive.materializedview.rewriting.incremental 
hive.server2.webui.cors.allowed.headers 
hive.driver.parallel.compilation 
hive.tez.bucket.pruning 
hive.hook.proto.base-directory 
hive.load.data.owner 
hive.execution.mode 
hive.service.metrics.codahale.reporter.classes 
hive.strict.managed.tables 
hive.create.as.insert.only 
hive.optimize.dynamic.partition.hashjoin 
hive.server2.webui.enable.cors 
hive.metastore.db.type 
hive.txn.strict.locking.mode 
hive.metastore.transactional.event.listeners 
hive.tez.input.generate.consistent.splits &lt;/PRE&gt;&lt;P&gt;Do you see any consequences?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 16:26:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218137#M180038</guid>
      <dc:creator>er_sharma_shant</dc:creator>
      <dc:date>2018-10-15T16:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: spark-sql  : Error in session initiation - NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning</title>
      <link>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218138#M180039</link>
      <description>&lt;P&gt;HDP 3.0 has different way of integrating Apache Hive with Apache Spark  using Hive Warehouse Connector.&lt;/P&gt;&lt;P&gt;Below article explains the steps: &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/content/kbentry/223626/integrating-apache-hive-with-apache-spark-hive-war.html" target="_blank"&gt;https://community.hortonworks.com/content/kbentry/223626/integrating-apache-hive-with-apache-spark-hive-war.html&lt;/A&gt;&lt;/P&gt;&lt;H1&gt;&lt;/H1&gt;</description>
      <pubDate>Mon, 29 Oct 2018 22:13:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/spark-sql-Error-in-session-initiation-NoClassDefFoundError/m-p/218138#M180039</guid>
      <dc:creator>er_sharma_shant</dc:creator>
      <dc:date>2018-10-29T22:13:31Z</dc:date>
    </item>
  </channel>
</rss>

