hbase查询时,出现以下异常:
Caused by: org.apache.hadoop.hbase.DoNotRetryIOException: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator at org.apache.hadoop.hbase.client.RpcRetryingCaller.translateException(RpcRetryingCaller.java:229) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:202) at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:326) at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:301) at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:166) at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:161) at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:794) at org.springframework.data.hadoop.hbase.HbaseTemplate$1.doInTable(HbaseTemplate.java:132) at org.springframework.data.hadoop.hbase.HbaseTemplate.execute(HbaseTemplate.java:61) ... 75 more
首先确认,Stopwatch在google的guava包下,果断开始查guava,发现项目里有两个版本的guava,删除一个,保留与当前hbase版本匹配的另一个,运行成功。
注,guava17开始,constructors发生变化,如果确认当前项目只有一个guava包,需确认版本问题。
测试,hbase1.2.1:guava12-16,运行无误;guava17开始,同样出现标题异常