Hbase and osgi - cannot find hbase-default.xml

since hbase is not available as the osgi-ified package, I managed to create a package with the maven felix plugin (hbase 0.92 and the corresponding hadoop-core 1.0.0), and both packages run on OSGi :)

hbase-default.xml is also added to the resulting set. in the resulting osgi-jar, when I open it, the structure is as follows:

  • org /
  • META-INF
  • HBase-default.xml

This was achieved using <Include-Resource>@${pkgArtifactId}-${pkgVersion}.jar!/hbase-default.xml</Include-Resource>

The problem arises when I really want to connect to hbase. hbase-default.xml could not be found, and therefore I cannot create a configuration file.

The hbase osgi package is used from another osgi package, which should be used to receive the hbase connection and query the database. This osgi package is used by the RCP application.

My question is: where should I put my hbase-default.xml so that it is found when the start is running? or why does he not understand that the file exists?

Thanks for any tips.

- edit

I found a decompiler so that I can see the source in which the configuration is loaded (hasoop-core, which does not provide any sources through maven), and now I see that the contextClassLoader Threads context is used (and if it is not available, the classLoader of the Configuration class itself ), so it seems to me that he cannot find the resource, but in accordance with the description he should also check his parents (but who is the parent in OSGi?)?

, OSGi, hbase, hbase-default.xml jar (. ), , contextClassLoader . , , HBaseConfiguration ( "" hadoop-, HBaseConfiguration, HBaseConfiguration , create().

, , :)

+3
3
Thread.currentThread().setContextClassLoader(HBaseConfiguration.class.getClassLoader());

, HBaseConfiguration, OSGI bundle.hbase, , (hbase-default.xml hbase-site.xml). TCCL .

+2

hbase-default.xml .jar, CLASSPATH, java.

hbase.

pom.xml: "process-resource" hbase-default.xml ' @@@VERSION @@@' . , โ€‹โ€‹ , < ", . pom.xml, ant , .

+1

, , hbase-site.xml , hbase, :

Use of this component in OSGi: this component is fully functional in the OSGi environment, however, this requires some user action. Hoadop uses the stream context class loader to load resources. Typically, a stream context class loader is a package class loader that contains routes. Thus, the default configuration files should be visible from the bundle class loader. A typical way to deal with it is to save a copy of core-default.xml in the root directory. This file can be found in the hasoop-common.jar file.

0
source

All Articles