If upgrading is an option, for HBase 1.1+ applications you can use a newer Protocol Buffers by relying on hbase-shaded-client as a dependency.
On Sun, Mar 19, 2017 at 12:04 PM, Josh Elser <[email protected]> wrote: > With Apache HBase 1.0-based applications, you must use Protocol Buffers 2.5 > in its standard package (e.g. com.google.protobuf). If you want to use > another version of protobuf, you would have to shade and relocate that > dependency. > > In newer versions of HBase (2.0 I believe it will land), does the above > recommendation (shade+relocate) internally. This would let you use whatever > version of Protobuf you'd like, regardless of what HBase is using. > > > Hef wrote: >> >> I change my application to use ProtocolBuffers 2.5 then this issue >> resolved. >> >> >> On Fri, Mar 17, 2017 at 12:36 PM, Hef<[email protected]> wrote: >> >>> Hi group, >>> I have a problem using ProtocolBuffers 3 in my application with CDH5.6 >>> HBase 1.0. >>> >>> When creating BufferedMutator and flush data into HBase, it shows an >>> error >>> as below: >>> >>> java.lang.NoClassDefFoundError: Could not initialize class >>> org.apache.hadoop.hbase.util.ByteStringer >>> at >>> org.apache.hadoop.hbase.protobuf.RequestConverter.buildRegionSpecifier( >>> RequestConverter.java:995) >>> at org.apache.hadoop.hbase.protobuf.RequestConverter. >>> buildGetRowOrBeforeRequest(RequestConverter.java:138) >>> at org.apache.hadoop.hbase.protobuf.ProtobufUtil. >>> getRowOrBefore(ProtobufUtil.java:1579) >>> at org.apache.hadoop.hbase.client.ConnectionManager$ >>> HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1293) >>> at org.apache.hadoop.hbase.client.ConnectionManager$ >>> HConnectionImplementation.locateRegion(ConnectionManager.java:1125) >>> at org.apache.hadoop.hbase.client.AsyncProcess.submit( >>> AsyncProcess.java:369) >>> at org.apache.hadoop.hbase.client.AsyncProcess.submit( >>> AsyncProcess.java:320) >>> at org.apache.hadoop.hbase.client.BufferedMutatorImpl. >>> backgroundFlushCommits(BufferedMutatorImpl.java:198) >>> at org.apache.hadoop.hbase.client.BufferedMutatorImpl. >>> doMutate(BufferedMutatorImpl.java:141) >>> at org.apache.hadoop.hbase.client.BufferedMutatorImpl. >>> mutate(BufferedMutatorImpl.java:105) >>> >>> It looks like HBase is using ProtocolBuffers2.5, which cause the bytecode >>> incompatible. >>> >>> Does anyone has experience of resolving this problem? Or I have to switch >>> back to protocol 2.5. >>> >>> >>> >>> >> >
