栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 前沿技术 > 云计算 > 云平台

tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase

云平台 更新时间:发布时间: 百科书网 趣学号

最近用原生hbase包开发,用到了guava包,用的版本是30.1.1-android,报了下了这个错误:
tried to access method com.google.common.base.Stopwatch.()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator

原因:在MetaTableLocator中有这样一个方法(这里hbase-client使用的是1.2.5版本,2.0.0版本没有这样一个类),

public ServerName blockUntilAvailable(final ZooKeeperWatcher zkw, int replicaId,
      final long timeout)
  throws InterruptedException {
    if (timeout < 0) throw new IllegalArgumentException();
    if (zkw == null) throw new IllegalArgumentException();
    //具体问题出现在这里
    Stopwatch sw = new Stopwatch().start();
    ServerName sn = null;
    try {
      while (true) {
        sn = getMetaRegionLocation(zkw, replicaId);
        if (sn != null || sw.elapsedMillis()
            > timeout - HConstants.SOCKET_RETRY_WAIT_MS) {
          break;
        }
        Thread.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
      }
    } finally {
      sw.stop();
    }
    return sn;
  }

再看方法中是使用的Stopwatch类无参构造没有使用访问修饰符,代码如下:

 Stopwatch() {
    this.ticker = Ticker.systemTicker();
 }

看到这里也不用过多解释,这里的解决办法是将guava版本升级到16.0.1。


    com.google.guava
    guava
    16.0.1

转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/1071934.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号