HBase ERROR: hbase-default.xml file seems to be for and old version of HBase (null)
Asked Answered
T

6

12

I am trying to write a program to connect to HBase. However when I execute following command HBaseConfiguration.create(); I get following error: .

"hbase-default.xml file seems to be for and old version of HBase (null), this version is 0.92.1-cdh4.1.2. When I dig deep and debug inside observe following:

    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);
            }
        }

In my case HBase returns default version as null, I am not sure why its returning as null as I checked the corresponding entry in hbase-default.xml packaged with the HBase.jar it has correct entry.

When I try the same thing from a standalone program it works as expected.

Guyz, Please let me know if you have any questions.

Thanks in advance, Rohit

Traweek answered 11/5, 2013 at 13:14 Comment(2)
I have same problem, did you find a solution?Loesceke
same problem here tooo.Cankerous
M
5
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property>
        <name>hbase.defaults.for.version.skip</name>
        <value>true</value>
    </property>
</configuration>

Add this to a hbase-default.xml and put the file in the classpath or resource foldr. I got it when i ran from within spring hadoop environment. By adding above file to reosurce folder of the job jar i was able to solve tis-

Micrometeorite answered 25/11, 2013 at 10:33 Comment(1)
This worked for me. Also details found here: ics.upjs.sk/~novotnyr/blog/334/setting-up-hbase-on-windowsBalakirev
C
1

finally found the workaround to this problem...

The problem is hbase-default.xml is not included in your classpath.

I added hbase-default.xml in target/test-classes ( it will vary in your case ), you can just add hbase-default.xml in various folder and see what works for you.

NOTE : This is just workaround, not the solution

Solution will be load the proper jars ( which I haven't figured out yet )

Cankerous answered 18/9, 2014 at 8:56 Comment(0)
A
1

I've been getting this error using HBase1.1.1. I created a simple HBase client and it worked fine. Then I built a simple RMI service, and that worked fine. But when I tried putting my simple HBase query code into RMI service I started getting this error on the HBaseConfiguration.create() call. After playing a bit, I found that the HBaseConfiguration.create() call works OK if placed before the security manager stuff that is in my main(). I get the error if the call is placed after block of code containing security manager calls...

Configuration conf = HBaseConfiguration.create(); // This works
if(System.getSecurityManager() == null)
{
  System.setSecurityManager(new SecurityManager());
} // End if
// Configuration conf = HBaseConfiguration.create(); // This fails

I get the error if the create() call happens in main() after that security manager block, or in code within the class that is instantiated by main(). I don't get the error if create() is called within a static{ } block in my RMI service class (which I believe gets called before main()), or in main() before the security manager block, as shown.

BTW, the jar files that I include in my class path in order to get a minimal client to run are the following: commons-codec-1.9.jar, commons-collections-3.2.1.jar, commons-configuration-1.6.jar, commons-lang-2.6.jar, commons-logging-1.2.jar, guava-12.0.1.jar, hadoop-auth-2.5.1.jar, hadoop-common-2.5.1.jar, hbase-client-1.1.1.jar, hbase-common-1.1.1.jar, hbase-hadoop2-compat-1.1.1.jar, hbase-it-1.1.1-tests.jar, hbase-protocol-1.1.1.jar, htrace-core-3.1.0-incubating.jar, log4j-1.2.17.jar, netty-all-4.0.23.Final.jar, protobuf-java-2.5.0.jar, slf4j-api-1.7.7.jar, slf4j-log4j12-1.7.5.jar

Ap answered 14/10, 2015 at 15:1 Comment(0)
A
0

Had a similar problem where the error was

java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (0.98.3-hadoop2), this version is Unknown
    at org.apache.hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:70)
    at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:102)
    at org.apache.hadoop.hbase.HBaseConfiguration.create(HBaseConfiguration.java:113)

In my case I had same set of jar files at two different levels of classpath, removed from one level and it worked fine.

Artois answered 29/3, 2016 at 6:20 Comment(0)
C
0

In my case the issue was caused by old java version (1.5), which was default on the server. But it works fine with 1.7.

Cranage answered 1/4, 2016 at 9:30 Comment(0)
I
0

In my code, I used this to solve my error.

val config = HBaseConfiguration.create()  //error
val config = new Configuration()  //works
Insomniac answered 17/2, 2023 at 2:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.