我正在尝试在我的app引擎servlet中写入cloud bigtable。我从https://github.com/GoogleCloudPlatform/cloud-bigtable-examples/blob/master/java/managed-vm-gae/gae-bigtable-hello/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java复制了BigTableHelper,在我的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);
}
}
put失败了,错误。
java.io.IOException:无法执行操作。在com.google.cloud.bigtable.hbase.BigtableTable.put(BigtableTable.java:288)的操作='put',projectId ='myprojectid',tableName ='test_table',rowKey ='row1'在......
引起: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:UNKNOWN at io.grpc.Status.asRuntimeException(Status.java:428)at io.grpc.stub.Calls $ UnaryStreamToFuture.onClose(Calls.java:324)at io.grpc.ChannelImpl $ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)的java上的$ CallImpl $ ClientStreamListenerImpl $ 3.run(ChannelImpl.java:402) .util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)... 1更多
引起:java.nio.channels.ClosedChannelException
BigtableHelper.getConnection()没有抛出异常,我假设它成功连接。 put语句有什么问题吗?什么可能导致这个问题?谢谢!
我们更新了使用Java 8从Google App Engine Flex和Standard与Cloud Bigtable进行交互的示例: