【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. 删除重复记录的最新sql脚本

    delete from tb1   where id in(select t2.minnum from(select MIN(t1.id) as minnum,t1.col1 as ars ,COUN ...

  2. UI7Kit

    [UI7Kit] UI7Kit is a GUI toolkit which can backport flat-style UIKit from iOS7 to iOS5/iOS6. Additio ...

  3. 分布式事务,EventBus 解决方案:CAP【中文文档】(转)

    出处:http://www.cnblogs.com/savorboard/p/cap-document.html 前言 很多同学想对CAP的机制以及用法等想有一个详细的了解,所以花了将近两周时间写了这 ...

  4. string 转换为枚举对应的值

    public static Object Parse(Type enumType,string value) 例如:(Colors)Enum.Parse(typeof(Colors), "R ...

  5. eclipse mac

    在mac下安装eclipse,挺简单的.只是字体会发虚,有点麻烦. 安装完成后,双击eclipse图标,显示包内容,contents--info.plist,在</dist>前加<k ...

  6. Oracle EBS FND User Info API

    1. 与用户信息相关API PKG. --和用户处理有关的API FND_USER_PKG;     --和用户密码处理有关的API FND_WEB_SEC;     --和用户职责处理有关的API ...

  7. cxrichedit导入WORD

    cxrichedit导入WORD word := CreateOLEObject('Word.Application');  word.Documents.Open(l_path,false);  w ...

  8. 升级windows 10后网络连接异常

    升级 windows 10,QQ无法连接,显示“登陆超时,请检查网络或者防火墙设置”.打开360软件助手,准备升级QQ试试,360软件助手也显示网络异常. 解决方法: 右键点击开始菜单,命令提示符(管 ...

  9. Tempdb--查看tempdb使用的脚本

    GO /****** Object: StoredProcedure [dbo].[usp_GetTempDBUsedSpace] Script Date: 03/05/2014 13:24:42 * ...

  10. Navicat 连接阿里云RDS

    背景: Navicat 是一个非常优秀与易用的数据库可视化管理软件,相信很多人都用过.这次服务器升级,数据库用了阿里云的RDS,阿里云自带的数据库管理面板功能有限,用不习惯.所以还是想着用 Navic ...