我正在尝试在我的应用程序引擎 servlet 中写入云 bigtable。我从https://github.com/GoogleCloudPlatform/cloud-bigtable-examples/blob/master/java/managed-vm-gae/gae-bigtable-hello/src/main/java/com.example.cloud复制了 BigTableHelper .bigtable.helloworld/BigtableHelper.java,在我的 servlet 中,我只是做了以下事情。
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
try (Table t = BigtableHelper.getConnection().getTable(BigtableHelper.TEST_TABLE)) {
Put put = new Put(Bytes.toBytes("row1"));
put.addColumn(BigtableHelper.RAW_UPDATE_FAMILY, BigtableHelper.RAW_UPDATE_QUALIFIER,
Bytes.toBytes("testdata"));
t.put(put);
} catch (IOException e) {
log("writeToBigtable", e);
}
}
放置失败并出现错误。
java.io.IOException:执行操作失败。Operation='put', projectId='myprojectid', tableName='test_table', rowKey='row1' at com.google.cloud.bigtable.hbase.BigtableTable.put(BigtableTable.java:288) at ...
原因:com.google.bigtable.repackaged.com.google.common.util.concurrent.UncheckedExecutionException: io.grpc.StatusRuntimeException: UNKNOWN at io.grpc.stub.Calls.getUnchecked(Calls.java:117) at io。 grpc.stub.Calls.blockingUnaryCall(Calls.java:129) 在 com.google.cloud.bigtable.grpc.BigtableGrpcClient.mutateRow(BigtableGrpcClient.java:210) 在 com.google.cloud.bigtable.hbase.BigtableTable.put( BigtableTable.java:285) ... 32 更多
引起:io.grpc.StatusRuntimeException:在 io.grpc.stub.Calls$UnaryStreamToFuture.onClose(Calls.java:324) 在 io.grpc.ChannelImpl 的 io.grpc.Status.asRuntimeException(Status.java:428) 未知$CallImpl$ClientStreamListenerImpl$3.run(ChannelImpl.java:402) at io.grpc.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java .util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ... 还有 1 个
引起:java.nio.channels.ClosedChannelException
BigtableHelper.getConnection() 没有抛出异常,我假设它连接成功。put语句有什么问题吗?什么可能导致这个问题?谢谢!