Issue connecting hbase client to Hortonworks HDP 2.5 virtual box


I downloaded hortonworks vm HDP 2.5 for virtualbox. I have set it up right and i can hit the browser on my windows and can use ambari, hbase etc. my primary purpose for this installation is to use hbase. I can ssh into vm and do hbase shell operations to create tables and do all operations. Now I want to write a client program on windows to interact with this hbase on vm. So i wrote a simple program that connects to hbase and list tables. But I am getting errors. As I can see from logs it can connect to zoo keeper but after that i get an error saying - “ An established connection was aborted by the software in your host machine” and " org.apache.hadoop.hbase.ipc.FailedServerException: This server is in the failed servers list:" and “ERROR [run-main-0-EventThread] zookeeper.ClientCnxn: EventThread shut down”.

I have hbase-site.xml file set in my classpath and i can see it reads the right parameters. I can also telnet onto these ports from my windows machine and reach them. I have searched on google but the solutions people provided hasn’t worked for me like commenting out localhost line in etc/hosts on virtual box or matching client libraries to HDP distribution libraries.

Below is my code to conenct to hbase:

val conf = HBaseConfiguration.create(); // parameters are loaded from file hbase-site.xml. I print the parameters to see they are loaded right.
val connection = ConnectionFactory.createConnection(conf);
val admin = connection.getAdmin();
val listtables = admin.listTables()

I believe it can reach zookeeper from my windows machine as i can see from logs connection established,
but then it says Hbase Master is not running and I can see it is reaching the right host for hbase master too( I can see from UI hbase master and regions servers are running at this host and port. still i get the above mentioned errors like master not running.

I am using Hortonworks HDP 2.5 and
client libraries “org.apache.hbase” % “hbase-client” % “” and “org.apache.hadoop” % “hadoop-client” % “”. I am using these client versions only to match whats on HDP 2.5. I have also attached screenshot of errors I am getting.

Any help is much appreciated. Thanks in advance.