我正在尝试编写一个连接HBase的程序.但是,当我执行以下命令HBaseConfiguration.create(); 我得到以下错误:.
"hbase-default.xml文件似乎是和旧版本的HBase(null),这个版本是0.92.1-cdh4.1.2.当我深入挖掘并调试内部时观察以下内容:
class HBaseConfiguration
private static void checkDefaultsVersion(Configuration conf) {
if (conf.getBoolean("hbase.defaults.for.version.skip", Boolean.FALSE))return;
String defaultsVersion = conf.get("hbase.defaults.for.version");
String thisVersion = VersionInfo.getVersion();
if (!thisVersion.equals(defaultsVersion)) {
throw new RuntimeException(
"hbase-default.xml file seems to be for and old version of HBase (" +
defaultsVersion + "), this version is " + thisVersion);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的情况下,HBase将默认版本返回为null,我不知道为什么它返回为null,因为我检查了与HBase.jar一起打包的hbase-default.xml中的相应条目,它具有正确的条目.
当我从独立程序尝试相同的事情时,它按预期工作.
Guyz,如果您有任何疑问,请与我们联系.
先谢谢,罗希特
小智 5
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>hbase.defaults.for.version.skip</name>
<value>true</value>
</property>
</configuration>
Run Code Online (Sandbox Code Playgroud)
将其添加到 hbase-default.xml 并将该文件放入类路径或资源文件夹中。当我从 spring hadoop 环境中运行时我得到了它。通过将上述文件添加到作业 jar 的资源文件夹中,我能够解决这个问题
| 归档时间: |
|
| 查看次数: |
4117 次 |
| 最近记录: |