hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ayache khettar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-11875) Referencing external package com/google/protobuf/ inside hbase-protcol module won't work in OSGI environment
Date Tue, 02 Sep 2014 06:12:21 GMT

    [ https://issues.apache.org/jira/browse/HBASE-11875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14117925#comment-14117925
] 

ayache khettar commented on HBASE-11875:
----------------------------------------

It doesn't offend, and that's what I have implemented as workaround see below . Sorry for
quickly jumping into suggestion that composition would solve the problem, still LiteralByteString
is package protected you can't use composition either. How about a new module in Hbase project:
google-protobuf-util which exposes only package: com.google.protobuf? And you will have it
as dependency for any modules which needs to use the ByteStringer class.

 static {
    try {
      HBaseZeroCopyByteString.wrap(new byte [0]);
    } catch (Throwable iae) {
      USE_ZEROCOPYBYTESTRING = false;
      LOG.debug("Failed to classload HBaseZeroCopyByteString: " + iae.toString());
    }
  }

> Referencing external package com/google/protobuf/ inside hbase-protcol module won't work
in OSGI environment
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-11875
>                 URL: https://issues.apache.org/jira/browse/HBASE-11875
>             Project: HBase
>          Issue Type: Improvement
>          Components: Protobufs
>    Affects Versions: 0.98.6
>         Environment: OSGI container
>            Reporter: ayache khettar
>
> Hi
> HbaseZeroCopyByteString class isn't accessible in OSGI based environment. The reason
is that it ends up in a separate route package within an OSGI bundle. As such the class isn't
viewable by the classLoader.
> I understand that the hbase-module isn't an osgi bundle, but there is another project
which makes use of this module to generate an osgi bundle for the OSGI container: https://github.com/apache/servicemix4-bundles/tree/trunk/hbase-0.98.0-hadoop2.
If you get hold of the binary or source artefact from maven, unzip the jar and you will see
the structure of the project:
> com/google/ (classes defined in this package are not visible by the classLoader).
> org/apache/hbase
> I understand the reason of having a foreign package, because  LiteralByteString is package
protected. It would be nice to work out another way of extending google protobuf classes.
I would recommend going for composition as opposed to inheritance that will solve the problem.
> Regards,
> Ayache
> Caused by: java.lang.NoClassDefFoundError: com/google/protobuf/HBaseZeroCopyByteString
> 	at org.apache.hadoop.hbase.protobuf.RequestConverter.buildRegionSpecifier(RequestConverter.java:908)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	at org.apache.hadoop.hbase.protobuf.RequestConverter.buildGetRowOrBeforeRequest(RequestConverter.java:132)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	at org.apache.hadoop.hbase.protobuf.ProtobufUtil.getRowOrBefore(ProtobufUtil.java:1466)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	at org.apache.hadoop.hbase.client.HTable$2.call(HTable.java:701)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	at org.apache.hadoop.hbase.client.HTable$2.call(HTable.java:699)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:121)[252:org.apache.servicemix.bundles.hbase:0.98.0.hadoop2-inps]
> 	... 56 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message