java连接HBase,连接不上报错can not resolve

[INFO] [2020-06-23 21:30:16][org.apache.hadoop.hbase.client.RpcRetryingCaller - 165]Call exception, tries=10, retries=35, started=47508 ms ago, cancelled=false, msg=java.net.UnknownHostException: can not resolve hserver1,16000,1592917603843, details=, see https://s.apache.org/timeout
[INFO] [2020-06-23 21:30:28][org.apache.hadoop.hbase.client.RpcRetryingCaller - 165]Call exception, tries=11, retries=35, started=59772 ms ago, cancelled=false, msg=java.net.UnknownHostException: can not resolve hserver1,16000,1592917603843, details=, see https://s.apache.org/timeout
[INFO] [2020-06-23 21:30:50][org.apache.hadoop.hbase.client.RpcRetryingCaller - 165]Call exception, tries=12, retries=35, started=82155 ms ago, cancelled=false, msg=java.net.UnknownHostException: can not resolve hserver1,16000,1592917603843, details=, see https://s.apache.org/timeout
[INFO] [2020-06-23 21:31:13][org.apache.hadoop.hbase.client.RpcRetryingCaller - 165]Call exception, tries=13, retries=35, started=104512 ms ago, cancelled=false, msg=java.net.UnknownHostException: can not resolve hserver1,16000,1592917603843, details=, see https://s.apache.org/timeout

java连接HBase,连接不上报错can not resolve

hserver1是我HBase的主机名,但是我的代码中并为出现该名词。

出现这种错误很有可能是hosts里面没有添加HBase的地址。

将HBase的ip地址写在hosts中便可正常。
java连接HBase,连接不上报错can not resolve

添加之后java就可以正常连接HBase了

java连接HBase,连接不上报错can not resolve