<?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 Non-local session path expected to be non-null trying to write batch on Hive in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176959#M64493</link>
    <description>&lt;P&gt;Greetings, &lt;/P&gt;&lt;P&gt;I'm currently using HDP 2.5 to get a working dataflow stack on a 6 node cluster (2 masters + 4 slaves, no Kerberos) using Kafka (2.10_0.10), Storm (1.0.1) and Hive2 (1.2.1). Storm (nimbus is on master-2) is able to communicate with Kafka (broker is on master-1), but can't seemingly operate on Hive (on master-1), even though it manages to connect to its metastore. For the Storm topology I'm using Trident APIs, here's what I'm using:&lt;/P&gt;&lt;PRE&gt;//HiveBolt
val mapper: DelimitedRecordHiveMapper =
  new DelimitedRecordHiveMapper()
    .withColumnFields(new Fields(colNames))
    .withTimeAsPartitionField("YYYY/MM/DD")
val hiveOptions: HiveOptions =
  new HiveOptions(metastore, dbName, tblName, mapper)
    .withTxnsPerBatch(10)
    .withBatchSize(1000)
    .withIdleTimeout(10)

//KafkaSpout
val spoutConf = new TridentKafkaConfig(zkHosts_2, "air_traffic")
spoutConf.scheme = new SchemeAsMultiScheme(new StringScheme())
val kafkaSpout = new OpaqueTridentKafkaSpout(spoutConf)

//Topology
val topology: TridentTopology = new TridentTopology
val factory: StateFactory = new HiveStateFactory().withOptions(hiveOptions)
val stream: trident.Stream = topology.newStream("jsonEmitter", kafkaSpout)
                              .each(new Fields("str"), new ParseJSON , new Fields(colNames))

stream.partitionPersist(factory, new Fields(colNames), new HiveUpdater(), new Fields()).parallelismHint(8)
&lt;/PRE&gt;&lt;P&gt;I thought originally it was a problem of permissions on either HDFS or the local filesystem, but even though I set 777 permissions on /tmp/hive, there's still this issue.&lt;/P&gt;&lt;P&gt;In core-site.xml:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;
                  
                    hadoop.proxyuser.hcat.group&lt;/LI&gt;&lt;/UL&gt;&lt;UL&gt;&lt;LI&gt;
  
    
  
  
    
  
  
  
    
  
  
    
  
&lt;P&gt;          
          
        
      
         
          
            
              
                
                  
                    hadoop.proxyuser.hcat.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hdfs.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hdfs.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hive.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hive.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.root.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.root.hosts
                    
                  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;are all set to '*'.&lt;/P&gt;&lt;P&gt;Hive2, as far as I see is correctly set to work with transactions, being the target table with transactional=true, stored as orc and bucketed. In the hive-site.xml:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;hive.compactor.worker.threads = 1&lt;/LI&gt;&lt;LI&gt;hive.compactor.initiator.on = true&lt;/LI&gt;&lt;LI&gt;hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's the stacktrace:&lt;/P&gt;&lt;PRE&gt;2017-07-08 10:02:36.896 o.a.s.h.t.HiveState [INFO] Creating Writer to Hive end point : {metaStoreUri='thrift://master-1.localdomain:9083,thrift://master-2.localdomain:9083', database='data_stream', table='air_traffic_test', partitionVals=[2017/07/189] }
2017-07-08 10:02:36.911 h.metastore [INFO] Trying to connect to metastore with URI thrift://master-1.localdomain:9083
2017-07-08 10:02:36.912 h.metastore [INFO] Connected to metastore.
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=Driver.run from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=TimeToSubmit from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 STDIO [ERROR] FAILED: NullPointerException Non-local session path expected to be non-null
2017-07-08 10:02:36.923 o.a.h.h.q.Driver [ERROR] FAILED: NullPointerException Non-local session path expected to be non-null
java.lang.NullPointerException: Non-local session path expected to be non-null
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
	at org.apache.hadoop.hive.ql.session.SessionState.getHDFSSessionPath(SessionState.java:590)
	at org.apache.hadoop.hive.ql.Context.&amp;lt;init&amp;gt;(Context.java:129)
	at org.apache.hadoop.hive.ql.Context.&amp;lt;init&amp;gt;(Context.java:116)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:382)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.runDDL(HiveEndPoint.java:404)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.createPartitionIfNotExists(HiveEndPoint.java:369)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.&amp;lt;init&amp;gt;(HiveEndPoint.java:276)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.&amp;lt;init&amp;gt;(HiveEndPoint.java:243)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnectionImpl(HiveEndPoint.java:180)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnection(HiveEndPoint.java:157)
	at org.apache.storm.hive.common.HiveWriter$5.call(HiveWriter.java:238)
	at org.apache.storm.hive.common.HiveWriter$5.call(HiveWriter.java:235)
	at org.apache.storm.hive.common.HiveWriter$9.call(HiveWriter.java:366)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;/PERFLOG method=compile start=1499504556923 end=1499504556923 duration=0 from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.924 o.a.s.h.t.HiveState [WARN] hive streaming failed.
java.lang.NullPointerException&lt;/PRE&gt;&lt;P&gt;From what I can gather, the NullpointerException is thrown in the following method inside SessionState:&lt;/P&gt;&lt;PRE&gt;public static Path getHDFSSessionPath(Configuration conf) {  
	SessionState ss = SessionState.get();  
	if (ss == null) {  
		String sessionPathString = conf.get(HDFS_SESSION_PATH_KEY);  
		Preconditions.checkNotNull(sessionPathString,  "Conf non-local session path expected to be non-null");  
		return new Path(sessionPathString);  
	}  
	Preconditions.checkNotNull(ss.hdfsSessionPath,  "Non-local session path expected to be non-null");  
	return ss.hdfsSessionPath;
}&lt;/PRE&gt;&lt;P&gt;Specifically, by: &lt;/P&gt;&lt;PRE&gt;Preconditions.checkNotNull(ss.hdfsSessionPath, "Non-local session path expected to be non-null");&lt;/PRE&gt;&lt;P&gt;So, it seems to be an hdfs related issue, but I can't understand why it's happening.&lt;/P&gt;&lt;P&gt;I hope someone can help me, I'll update the post with more information if needed.&lt;/P&gt;</description>
    <pubDate>Sat, 08 Jul 2017 16:46:30 GMT</pubDate>
    <dc:creator>f_dambrosio</dc:creator>
    <dc:date>2017-07-08T16:46:30Z</dc:date>
    <item>
      <title>Non-local session path expected to be non-null trying to write batch on Hive</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176959#M64493</link>
      <description>&lt;P&gt;Greetings, &lt;/P&gt;&lt;P&gt;I'm currently using HDP 2.5 to get a working dataflow stack on a 6 node cluster (2 masters + 4 slaves, no Kerberos) using Kafka (2.10_0.10), Storm (1.0.1) and Hive2 (1.2.1). Storm (nimbus is on master-2) is able to communicate with Kafka (broker is on master-1), but can't seemingly operate on Hive (on master-1), even though it manages to connect to its metastore. For the Storm topology I'm using Trident APIs, here's what I'm using:&lt;/P&gt;&lt;PRE&gt;//HiveBolt
val mapper: DelimitedRecordHiveMapper =
  new DelimitedRecordHiveMapper()
    .withColumnFields(new Fields(colNames))
    .withTimeAsPartitionField("YYYY/MM/DD")
val hiveOptions: HiveOptions =
  new HiveOptions(metastore, dbName, tblName, mapper)
    .withTxnsPerBatch(10)
    .withBatchSize(1000)
    .withIdleTimeout(10)

//KafkaSpout
val spoutConf = new TridentKafkaConfig(zkHosts_2, "air_traffic")
spoutConf.scheme = new SchemeAsMultiScheme(new StringScheme())
val kafkaSpout = new OpaqueTridentKafkaSpout(spoutConf)

//Topology
val topology: TridentTopology = new TridentTopology
val factory: StateFactory = new HiveStateFactory().withOptions(hiveOptions)
val stream: trident.Stream = topology.newStream("jsonEmitter", kafkaSpout)
                              .each(new Fields("str"), new ParseJSON , new Fields(colNames))

stream.partitionPersist(factory, new Fields(colNames), new HiveUpdater(), new Fields()).parallelismHint(8)
&lt;/PRE&gt;&lt;P&gt;I thought originally it was a problem of permissions on either HDFS or the local filesystem, but even though I set 777 permissions on /tmp/hive, there's still this issue.&lt;/P&gt;&lt;P&gt;In core-site.xml:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;
                  
                    hadoop.proxyuser.hcat.group&lt;/LI&gt;&lt;/UL&gt;&lt;UL&gt;&lt;LI&gt;
  
    
  
  
    
  
  
  
    
  
  
    
  
&lt;P&gt;          
          
        
      
         
          
            
              
                
                  
                    hadoop.proxyuser.hcat.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hdfs.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hdfs.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hive.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.hive.hosts&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.root.groups&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;hadoop.proxyuser.root.hosts
                    
                  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;are all set to '*'.&lt;/P&gt;&lt;P&gt;Hive2, as far as I see is correctly set to work with transactions, being the target table with transactional=true, stored as orc and bucketed. In the hive-site.xml:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;hive.compactor.worker.threads = 1&lt;/LI&gt;&lt;LI&gt;hive.compactor.initiator.on = true&lt;/LI&gt;&lt;LI&gt;hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's the stacktrace:&lt;/P&gt;&lt;PRE&gt;2017-07-08 10:02:36.896 o.a.s.h.t.HiveState [INFO] Creating Writer to Hive end point : {metaStoreUri='thrift://master-1.localdomain:9083,thrift://master-2.localdomain:9083', database='data_stream', table='air_traffic_test', partitionVals=[2017/07/189] }
2017-07-08 10:02:36.911 h.metastore [INFO] Trying to connect to metastore with URI thrift://master-1.localdomain:9083
2017-07-08 10:02:36.912 h.metastore [INFO] Connected to metastore.
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=Driver.run from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=TimeToSubmit from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.923 STDIO [ERROR] FAILED: NullPointerException Non-local session path expected to be non-null
2017-07-08 10:02:36.923 o.a.h.h.q.Driver [ERROR] FAILED: NullPointerException Non-local session path expected to be non-null
java.lang.NullPointerException: Non-local session path expected to be non-null
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
	at org.apache.hadoop.hive.ql.session.SessionState.getHDFSSessionPath(SessionState.java:590)
	at org.apache.hadoop.hive.ql.Context.&amp;lt;init&amp;gt;(Context.java:129)
	at org.apache.hadoop.hive.ql.Context.&amp;lt;init&amp;gt;(Context.java:116)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:382)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.runDDL(HiveEndPoint.java:404)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.createPartitionIfNotExists(HiveEndPoint.java:369)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.&amp;lt;init&amp;gt;(HiveEndPoint.java:276)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.&amp;lt;init&amp;gt;(HiveEndPoint.java:243)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnectionImpl(HiveEndPoint.java:180)
	at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnection(HiveEndPoint.java:157)
	at org.apache.storm.hive.common.HiveWriter$5.call(HiveWriter.java:238)
	at org.apache.storm.hive.common.HiveWriter$5.call(HiveWriter.java:235)
	at org.apache.storm.hive.common.HiveWriter$9.call(HiveWriter.java:366)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

2017-07-08 10:02:36.923 o.a.h.h.q.l.PerfLogger [INFO] &amp;lt;/PERFLOG method=compile start=1499504556923 end=1499504556923 duration=0 from=org.apache.hadoop.hive.ql.Driver&amp;gt;
2017-07-08 10:02:36.924 o.a.s.h.t.HiveState [WARN] hive streaming failed.
java.lang.NullPointerException&lt;/PRE&gt;&lt;P&gt;From what I can gather, the NullpointerException is thrown in the following method inside SessionState:&lt;/P&gt;&lt;PRE&gt;public static Path getHDFSSessionPath(Configuration conf) {  
	SessionState ss = SessionState.get();  
	if (ss == null) {  
		String sessionPathString = conf.get(HDFS_SESSION_PATH_KEY);  
		Preconditions.checkNotNull(sessionPathString,  "Conf non-local session path expected to be non-null");  
		return new Path(sessionPathString);  
	}  
	Preconditions.checkNotNull(ss.hdfsSessionPath,  "Non-local session path expected to be non-null");  
	return ss.hdfsSessionPath;
}&lt;/PRE&gt;&lt;P&gt;Specifically, by: &lt;/P&gt;&lt;PRE&gt;Preconditions.checkNotNull(ss.hdfsSessionPath, "Non-local session path expected to be non-null");&lt;/PRE&gt;&lt;P&gt;So, it seems to be an hdfs related issue, but I can't understand why it's happening.&lt;/P&gt;&lt;P&gt;I hope someone can help me, I'll update the post with more information if needed.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 16:46:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176959#M64493</guid>
      <dc:creator>f_dambrosio</dc:creator>
      <dc:date>2017-07-08T16:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Non-local session path expected to be non-null trying to write batch on Hive</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176960#M64494</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/21174/fdambrosio.html" nodeid="21174"&gt;@Federico D'Ambrosio&lt;/A&gt;&lt;P&gt;The original error looks to be caused by a lib mismatch where storm-hive is set to use 0.9.0 ( &lt;A href="https://github.com/hortonworks/storm-release/blob/HDP-2.5.3.0-tag/external/storm-hive/pom.xml" target="_blank"&gt;https://github.com/hortonworks/storm-release/blob/HDP-2.5.3.0-tag/external/storm-hive/pom.xml&lt;/A&gt; ) when I think it should be set to the thrift.version variable from the parent storm-release pom (https://github.com/hortonworks/storm-release/blob/HDP-2.5.3.0-tag/pom.xml). &lt;/P&gt;&lt;P&gt;This issue is addressed in HDP 2.5.5 and HDP 2.6.1. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 13:46:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176960#M64494</guid>
      <dc:creator>ssubhas</dc:creator>
      <dc:date>2017-07-12T13:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Non-local session path expected to be non-null trying to write batch on Hive</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176961#M64495</link>
      <description>&lt;P&gt;Apparently that was really a jar dependencies issue. Even though I'm 
using HDP 2.5.5, so I'm not sure what &lt;A rel="user" href="https://community.cloudera.com/users/5019/ssubhas.html" nodeid="5019"&gt;@Sindhu&lt;/A&gt; describes applies to me, it 
turns out that the tag versioning applied to Hortonworks jars was the 
only factor causing this kind of issue. &lt;/P&gt;&lt;P&gt;As a matter of fact, I 
was bundling in the jar submitted to storm the dependencies without the 
"-157" (while using the correct major, minor and hotfix versions), which can be found on mavencentral. In order to get everything 
working I had to use the dependencies from 
&lt;A href="http://nexus-private.hortonworks.com/nexus/content/groups/public/" target="_blank"&gt;http://nexus-private.hortonworks.com/nexus/content/groups/public/&lt;/A&gt; , 
since I couldn't find them on 
&lt;A href="http://repo.hortonworks.com/content/repositories/releases/" target="_blank"&gt;http://repo.hortonworks.com/content/repositories/releases/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 14:46:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Non-local-session-path-expected-to-be-non-null-trying-to/m-p/176961#M64495</guid>
      <dc:creator>f_dambrosio</dc:creator>
      <dc:date>2017-07-12T14:46:59Z</dc:date>
    </item>
  </channel>
</rss>

