There is a question here connect from java to Hive but mine is different
My hive running on machine1 and I need to pass some queries using Java server
Answering my own question!
With some hit and trial, I have added following dependencies on my pom file and since then I am able to run code on both CHD 5.3.1 and 5.2.1 cluster.
org.apache.hive
hive-jdbc
0.13.1-cdh5.3.1
org.apache.thrift
libthrift
0.9.0
org.apache.thrift
libfb303
0.9.0
org.apache.hadoop
hadoop-core
2.5.0-mr1-cdh5.3.1
org.apache.hadoop
hadoop-common
2.5.0-cdh5.3.1
org.apache.hive
hive-exec
0.13.1-cdh5.3.1
org.apache.hadoop
hadoop-hdfs
2.5.0-cdh5.3.1
Please note that some of these dependencies might not be required