gpt4 book ai didi

java - HBase 获取扫描器异常 - "This is supposed to be overridden by subclasses"

转载 作者:可可西里 更新时间:2023-11-01 15:33:33 29 4
gpt4 key购买 nike

我正在尝试运行以下代码:

Cluster cluster = new Cluster();
cluster.add("localhost", port_number);
Client client = new Client(cluster);
RemoteHTable table = new RemoteHTable(client, "my_table");
Scan scan = new Scan();
scan.setStartRow(startKey);
scan.setStopRow(endKey);
scan.addFamily(columnFamily);
ResultScanner scanner = table.getScanner(scan);

但最后一行抛出:

Exception in thread "main" java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.    at com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:180)    at org.apache.hadoop.hbase.rest.protobuf.generated.ScannerMessage$Scanner.getSerializedSize(ScannerMessage.java:274)    at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:62)    at org.apache.hadoop.hbase.rest.model.ScannerModel.createProtobufOutput(ScannerModel.java:705)    at org.apache.hadoop.hbase.rest.client.RemoteHTable$Scanner.(RemoteHTable.java:510)    at org.apache.hadoop.hbase.rest.client.RemoteHTable.getScanner(RemoteHTable.java:620)    at com.amazon.cq.banyan.hbase.example.HBaseRestClient.main(HBaseRestClient.java:55)

This is my pom.xml:

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.6.0</version>
</dependency>

<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.94.18</version>
</dependency>

尝试执行 Put 时也会发生这种情况。

最佳答案

这是由于使用了不同版本的 protobuf jar。此链接将帮助您理解问题 https://code.google.com/p/protobuf/issues/detail?id=493

关于java - HBase 获取扫描器异常 - "This is supposed to be overridden by subclasses",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29044309/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com