【From】 https://blog.yoodb.com/yoodb/article/detail/157

使用HBase Java Client连接HBase服务端创建Configuration对象时遇到了此类错误,“hbase-default.xml file seems to be for and old version of HBase的异常”,经过查询资料总结经验。

分析异常出现的原因

HBase客户端创建Configuration对象时,需要使用hbase-*.jar包,其中*部分标识了连接的HBase版本号:

[root@xxxxxx]$ ls hbase-*.jar
hbase-0.92.1.jar

在hbase-*.jar包的hbase-default.xml中,有一个关于HBase默认版本号的配置项如下:

<property skipInDoc="true">
    <name>hbase.defaults.for.version</name>
    <value>0.92.1</value>
    <description>
    This defaults file was compiled for version 0.92.1. This variable is used
    to make sure that a user doesn't have an old version of hbase-default.xml on the
    classpath.    </description>
  </property>

当客户端启动时,首先会检测此包中所指定的版本号以及hbase-default.xml中设置的hbase.defaults.for.version版本号是否一致。正常情况下二者是一致,不会抛出Exception。

如果指定版本号小于hbase.defaults.for.version指定版本号,就会抛出如下异常:

Exception in thread "main" java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (@@@VERSION@@@), this version is 0.92.1
        at org.apache.Hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:68)
        at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:100)
        at org.apache.hadoop.hbase.HBaseConfiguration.create(HBaseConfiguration.java:111)
        at org.apache.hadoop.hbase.util.HBaseConfTool.main(HBaseConfTool.java:38)
Exception in thread "main" java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (@@@VERSION@@@), this version is 0.92.1
...

解决方式

异常情况一:

Caused by: java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (*.**.*), this version is 0.92.1
        at org.apache.hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:68)
        at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:100)

原因是hbase-default.xml中的hbase.defaults.for.version配置项与hbase-*.jar名中指定版本号不一致,打开工程目录下的hbase-site.xml,将hbase.defaults.for.version.skip配置为true,忽略默认版本的检查代码如下:

<property>
    <name>hbase.defaults.for.version.skip</name>
    <value>true</value>
    <description>
    Set to true to skip the 'hbase.defaults.for.version' check.
    Setting this to true can be useful in contexts other than
    the other side of a maven generation; i.e. running in an
    ide.  You'll want to set this boolean to true to avoid
    seeing the RuntimException complaint: "hbase-default.xml file
    seems to be for and old version of HBase (0.92.1), this
    version is X.X.X-SNAPSHOT"    </description>
  </property>

异常情况二:

Caused by: java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (null), this version is 0.92.1
        at org.apache.hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:68)
        at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:100)

加载hbase-default.xml失败没有获取默认的版本号,因实际情况而定试一试删除Java的工程目录下的hbase-default.xml文件。

异常情况三:(maven下载jar包导致)

Caused by: java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (@@@VERSION@@@), this version is 0.92.1
        at org.apache.hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:68)
        at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:100)

hbase-default.xml中的hbase.defaults.for.version配置项在打包时没有被正常替换成maven指定的版本号打开HBase maven工程的pom.properties文件,确定是否指定了version=0.92.1这一配置选项,如果没有,加上后进行重新包,也可以参考第一种异常解决方案操作。

[转] HBase异常:hbase-default.xml file seems to be for an old version of HBase的更多相关文章

  1. 关于hbase中的hbase-site.xml 配置详解

    该文档是用Hbase默认配置文件生成的,文件源是 hbase-default.xml hbase.rootdir 这个目录是region server的共享目录,用来持久化HBase.URL需要是'完 ...

  2. Android(java)学习笔记152:Android运行时异常“Binary XML file line # : Error inflating class”

    在原生Android下编译APK,编译没有问题,但是在运行的时候经常出现如标题所描述的异常:"Binary XML file line # : Error inflating class&q ...

  3. Android(java)学习笔记95:Android运行时异常"Binary XML file line # : Error inflating class"

    在原生Android下编译APK,编译没有问题,但是在运行的时候经常出现如标题所描述的异常:"Binary XML file line # : Error inflating class&q ...

  4. hbase 异常

    1.org.apache.hadoop.hbase.ipc.CallTimeoutException a.出现情况描述:使用java API进行hbase数据的scan操作,发现有的数据可以scan到 ...

  5. 异常 ndroid.view.InflateException: Binary XML file line #8: Error inflating class com.ouyang.test.MyView

    发现自定义view时出现ndroid.view.InflateException: Binary XML file line #8: Error inflating class com.ouyang. ...

  6. CDH5..4.7+phoenix实现查询HBase异常:java.sql.SQLException: ERROR 1102 (XCL02): Cannot get all table regions

    基础环境是用CM 安装的cdh5.4.7,phoenix使用的版本是phoenix-4.5.2-HBase-1.0-bin. 出现异常信息:java.sql.SQLException: ERROR 1 ...

  7. Java连接Hbase异常

    Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Faile ...

  8. bug_ _ android.view.InflateException: Binary XML file line #2: Error inflating class <unknown

    ========= 5.0     android异常“android.view.InflateException: Binary XML file line # : Error inflating ...

  9. ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id

    出现场景:当点击"分类"再返回"首页"时,发生error退出   BUG描述:Caused by: java.lang.IllegalArgumentExcep ...

随机推荐

  1. Oracle学习笔记(四)

    六.约束 1.约束的作用 定义规则:什么数据可以输入,什么不可以 确保完整性:数据的精确性和可靠性 2.Oracle五个重要的约束: 非空约束.主键约束.外键约束.检查约束.唯一约束. (1)非空约束 ...

  2. Zend_Application 流程详解

    本周没什么工作,zend 系统性的东西渐渐忘记,抽时间整理一下代码!Zend_Application 负责加载配置以及初始化资源,所以index.php 会有这行代码 /** Zend_Applica ...

  3. 关于windows服务注册的问题

    开发工具:VS2012 语言:C# 今天的工作内容是把wcf服务以windows服务的方式运行,由于之前没有做过windows服务,所有在网上找了些文章来看下,发现创建windows 服务是一件很简单 ...

  4. 8.使用Exists监控ZNode的三大Change事件

    一. zookeeper是一个分布式的协调程序(所有程序都是通过订阅它来相互感知)   1. tcp(长链接) + watcher server ->client client ->ser ...

  5. onenote无法更新,提示无法流式传输、无法登陆等问题解答

    onenote无法更新,提示无法流式传输 修改DNS 4.2.2.1 和 4.2.2.2 onenote反复提示登录 升级到IE11

  6. The Scope Chain

    JavaScript is a lexically scoped language: the scope of variable can be thought of as the set of sou ...

  7. 一个hql语句

    在hql语句里面,in的使用方法比较特别. from DomesticCat cat where cat.name in ( 'Foo', 'Bar', 'Baz' ) in后面是一个list,我写的 ...

  8. PPI协议(西门子PLCS7-200)

    西门子PLC S7-200 PPI协议报文,9600,偶校验,8数据位,1停止位 读取vb100寄存器:PC发送报文68 1B 1B 68 2 0 6C 32 1 0 0 0 0 0 E 0 0 4 ...

  9. Visual Studio for mac从入门到放弃1

    MAC  第一步:从微软官网下载:https://www.visualstudio.com/vs/visual-studio-mac/ 第二步:安装软件过程出现 It was not possible ...

  10. ajaxfileupload插件上传图片功能,用MVC和aspx做后台各写了一个案例

    HTML代码 和js 代码 @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name=&quo ...