+Hbase, Karaf
Following are the version detail:
Karaf: 3.0.3
Java: 1.7
HBase: 1.0.1
Our project: https://github.com/opendaylight/tsdr
Summarizing the issue again.
Our project runs in karaf container. We have HBase installed in the same
machine where karaf is running. When our feature (project) comes up, we connect
to the HBase server via hbase-client. With Hbase 0.94.*, our feature runs
without any issues.
We are trying to use latest/stable HBase version - 1.0.1. We observe the
classes that belongs to single JAR is splitted into hbase-client.jar and
hbase-common.jar in 1.0.1. Compilation goes fine after adding all required
changes in build artifacts etc (enclosed the diff) to point to 1.0.1. After
bringing up the karaf and when we install our feature, it fails with
ClassNotFoundException as shown in my email below.
Code pointer which initiates the connect to HBase server:
https://github.com/opendaylight/tsdr/blob/master/persistence-hbase/src/main/java/org/opendaylight/tsdr/persistence/hbase/HBaseDataStore.java
Could someone shed some light on the approach?
Thanks,
Hari
From: Sethuraman, Hariharan
Sent: Sunday, May 24, 2015 11:26 PM
To: '[email protected]'
Cc: C, Yuling; '[email protected]';
[email protected]<mailto:[email protected]>;
Venkataraghavan, C
Subject: RE: [opendaylight.org #11082] RE: Maven repo: library versions
Hi,
I continued with higher hbase version (1.0.1) and hitting the next issue.
java.lang.Exception: Error creating table.
at
org.opendaylight.tsdr.persistence.hbase.HBaseDataStore.createTable(HBaseDataStore.java:171)[303:org.opendaylight.tsdr.persistence-hbase:1.0.0.SNAPSHOT]
...
Caused by: java.lang.NoClassDefFoundError:
org/apache/hadoop/hbase/HBaseConfiguration
at
org.opendaylight.tsdr.persistence.hbase.HBaseDataStore.createTable(HBaseDataStore.java:149)[303:org.opendaylight.tsdr.persistence-hbase:1.0.0.SNAPSHOT]
... 10 more
Caused by: java.lang.ClassNotFoundException:
org.apache.hadoop.hbase.HBaseConfiguration
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:455)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at
java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_75]
... 11 more
I have included both hbase-common and hbase-client as dependencies in
persistence-hbase/pom.xml. Is the package org.apache.hbase.hadoop which exists
in both hbase-common and hbase-client libraries is the root cause? Because when
the classes from hbase-client is loaded first and class-loaders probably is
disallowing the classes from hbase-common to be loaded into JVM sandbox!!
Attached the code diff and hbase-common,hbase-client's common package sample
screenshot below.
[cid:[email protected]]
I think normally we could write our own class-loader and handle this situation.
I don't know how to solve in karaf(osgi) environment. Please shed some light.
Thanks,
Hari
P.S: I tried to change the dependency/feature orders in pom.xml, feature.xml
and seeing no change from the above behavior.
<Snipped>
diff --git a/features/pom.xml b/features/pom.xml
index 92e31c4..b4dc3bb 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -74,15 +74,19 @@
<artifactId>tsdr-persistence-hbase</artifactId>
<version>${tsdr.project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
+ <artifactId>hbase-client</artifactId>
<version>${hbase.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-core</artifactId>
+ <artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
diff --git a/features/src/main/resources/features.xml
b/features/src/main/resources/features.xml
index ac88918..67dbd37 100644
--- a/features/src/main/resources/features.xml
+++ b/features/src/main/resources/features.xml
@@ -53,7 +53,7 @@
<configfile
finalname="${config.configfile.directory}/151-TSDR-datacollection-config.xml">mvn:org.opendaylight.tsdr/${artifactName}-datacollection/${project.version}/xml/config</configfile>
</feature>
- <feature name="odl-hbaseclient" version="0.94.15" resolver="(obr)"
start-level="50" description='OpenDaylight :: TSDR :: HBase Client'>
+ <feature name="odl-hbaseclient" version="1.0.1" resolver="(obr)"
start-level="50" description='OpenDaylight :: TSDR :: HBase Client'>
<feature>war</feature>
<bundle
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.2/1.9.0</bundle>
<bundle
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/1.9.0</bundle>
@@ -77,13 +77,14 @@
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty/6.1.26_4</bundle>
<bundle
dependency="true">mvn:org.apache.zookeeper/zookeeper/3.3.5</bundle>
<bundle>wrap:mvn:com.google.protobuf/protobuf-java/2.4.1</bundle>
- <bundle>wrap:mvn:org.apache.hadoop/hadoop-core/1.2.0</bundle>
- <bundle>wrap:mvn:org.apache.hbase/hbase/0.94.15</bundle>
+ <bundle>wrap:mvn:org.apache.hadoop/hadoop-common/2.5.2</bundle>
+ <bundle>wrap:mvn:org.apache.hbase/hbase-common/1.0.1</bundle>
+ <bundle>wrap:mvn:org.apache.hbase/hbase-client/1.0.1</bundle>
</feature>
<feature name='odl-tsdr-hbase-persistence' version='${project.version}'
description="OpenDaylight :: TSDR :: HBase Persistence">
- <feature version='"0.94.15"'>odl-hbaseclient</feature>
+ <feature version='"1.0.1"'>odl-hbaseclient</feature>
<feature version='${yangtools.version}'>odl-yangtools-common</feature>
<feature version='${yangtools.version}'>odl-yangtools-binding</feature>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
diff --git a/persistence-hbase/pom.xml b/persistence-hbase/pom.xml
index 832d85c..b6ebb03 100644
--- a/persistence-hbase/pom.xml
+++ b/persistence-hbase/pom.xml
@@ -47,14 +47,19 @@
</build>
<dependencies>
<dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
+ <artifactId>hbase-common</artifactId>
<version>${hbase.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-core</artifactId>
- <version>${hadoop.version}</version>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.tsdr</groupId>
diff --git a/pom.xml b/pom.xml
index 4fd7236..4ab6974 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,8 +4,8 @@
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath/>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../odlparent/odlparent</relativePath>
</parent>
<packaging>pom</packaging>
@@ -20,8 +20,8 @@
<config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
<equinox.osgi.version>3.8.1.v20120830-144521</equinox.osgi.version>
<features.test.version>1.5.0-SNAPSHOT</features.test.version>
- <hbase.version>0.94.15</hbase.version>
- <hadoop.version>1.2.0</hadoop.version>
+ <hbase.version>1.0.1</hbase.version>
+ <hadoop.version>2.5.2</hadoop.version>
<ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
<ietf-yang-types.version>2010.09.24.4-SNAPSHOT</ietf-yang-types.version>
<java.version.source>1.7</java.version.source>