Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 05-18-2016 05:08 PM
I am trying to write to HBase from SparkStreaming job.
I get the following exception when calling:
table.put(_config,put);
java.lang.NullPointerException
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:269)
I see that the configuration value is not correct but I tried to set up values I don't know exactly which values to setup
I am running on azure with hortonworks sandbox and running the job via spark-submit with --jars supplying the entire jars needed to run. (spark version 1.6)
The streaming is running perfect except that I cant write to HBase
Here is my code to put data:
class Adapter extendsSerializable{
var_conf = new HBaseConfiguration()
val_admin = new HBaseAdmin(_conf)
defPutData(tableName:String,columnFamily:String,key:String,data:String){
// _conf = HBaseConfiguration.create().asInstanceOf[HBaseConfiguration]
_conf.addResource("//etc//hbase//conf//hbase-site.xml")
_conf.set("hbase.zookeeper.quorum","sandbox.hortonworks.com");
_conf.setInt("hbase.zookeeper.clientport",2181);
println(_conf.get("hbase.zookeeper.quorum"));
println(_conf.get("hbase.zookeeper.clientport"));
valtable = new HTable(_conf,tableName)
valput = new Put(Bytes.toBytes(key));
valobj = JSON.parseFull(data);
objmatch {
caseSome(m:Map[String,Any])=>
m.map((r)=>{
valv=r._2.asInstanceOf[String];
put.add(Bytes.toBytes(columnFamily),Bytes.toBytes(r._1),Bytes.toBytes(v))
//println(r._1+":"+v)
})
}
println("writing to HBase");
table.put(put);
}
}
Created 05-18-2016 05:19 PM
Try setting zookeeper znode property as per your cluster conf, it will help.
conf.set("zookeeper.znode.parent", "VALUE")
Thanks
Created 05-18-2016 05:19 PM
Try setting zookeeper znode property as per your cluster conf, it will help.
conf.set("zookeeper.znode.parent", "VALUE")
Thanks
Created 05-18-2016 05:31 PM
Why your confs have double slash( "//") in path everywhere?
Created 05-18-2016 05:39 PM
Hi thank you for the answer .
Tried it
Didn't help the same exception
I put the following code:
_conf.set("zookeeper.znode.parent", "//hbase-unsecure") //copied the value from the configuration file
Created 05-18-2016 05:46 PM
Can you please remove one "/" from "//hbase-unsecure" and try again? @Avraha Zilberman
Created 05-18-2016 06:18 PM
Solved
Many thanks
I will try to remove the slashes on addresource and see if it solves also
Many thanks
Created 05-18-2016 05:23 PM
Hi thank you for the answer .
Tried it
Didn't help the same exception
I put the following code:
_conf.set("zookeeper.znode.parent", "//hbase-unsecure") //copied the value from the configuration file
Created 05-26-2016 05:54 AM
I believe it should be like _conf.set("zookeeper.znode.parent", "/hbase-unsecure")