Caused by: java.lang.RuntimeException: java.io.IOException: java.lang.reflect.InvocationTargetException
at org.apache.hadoop.hbase.client.HTableFactory.createHTableInterface(HTableFactory.java:43)
at org.apache.hadoop.hbase.client.HTablePool.createHTable(HTablePool.java:272)
at org.apache.hadoop.hbase.client.HTablePool.findOrCreateTable(HTablePool.java:202)
at org.apache.hadoop.hbase.client.HTablePool.getTable(HTablePool.java:182)
at org.apache.hadoop.hbase.client.HTablePool.getTable(HTablePool.java:220)
at com.baidu.util.PooledHTableFactory.createHTableInterface(PooledHTableFactory.java:22)
at org.springframework.data.hadoop.hbase.HbaseUtils.getHTable(HbaseUtils.java:73)
78,2-9 52%
at com.baidu.util.PooledHTableFactory.createHTableInterface(PooledHTableFactory.java:22)
at org.springframework.data.hadoop.hbase.HbaseUtils.getHTable(HbaseUtils.java:73)
... 12 more
Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:240)
at org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:433)
at org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:426)
at org.apache.hadoop.hbase.client.ConnectionManager.getConnectionInternal(ConnectionManager.java:304)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:185)
at org.apache.hadoop.hbase.client.HTableFactory.createHTableInterface(HTableFactory.java:41)
... 18 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:238)
... 23 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.protobuf.ProtobufUtil
at org.apache.hadoop.hbase.ClusterId.parseFrom(ClusterId.java:64)
at org.apache.hadoop.hbase.zookeeper.ZKClusterId.readClusterIdZNode(ZKClusterId.java:75)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:105)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.retrieveClusterId(ConnectionManager.java:919)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.<init>(ConnectionManager.java:657)
... 28 more
上网找了说有两种情况
- 缺少protobuf-java 2.5.0的jar包
- 多个protobuf jar包互相冲突
我出现这个问题的时候,protobuf没有冲突,而且是2.5.0版本的。后来debug半天才发现在项目中hbase-site.xml中hbase.rootdir配置项写错成一个不存在的hdfs的host了,修改成正确的hdfs uri即可。奇怪的是在日志中并没有报出连不上hbase.rootdir的问题