Java connection zookeeper high availability hive error

Today, when using java to connect zookeeper high availability hive, errors are reported:

java.lang.NullPointerException

at org.apache.thrift.transport.TSocket.open(TSocket.java:209)

 

 

My current Hadoop and hive versions are as follows:

< hadoop.version> 2.6.0-cdh5.5.2
< hive.version> 1.1.0-cdh5.16.2

At this time, I use the old connection string to connect without error:

“jdbc:hive2://marshal:10000”;

However, if a new connection string is used to connect, an error is reported:

“jdbc:hive2://marshal:2181,marshal01:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2_zk”;

  After some experiments, the final solution is to make the hive version a little higher than the Hadoop version

< hadoop.version> 2.6.0-cdh5.5.2
< hive.version> 1.1.0-cdh5.6.0

There will be no error at this time

Read More: