尝试在GAE中写入Cloud Bigtable时出现ClosedChannelException

时间:2015-07-25 19:38:01

标签: google-app-engine google-cloud-bigtable

我正在尝试在我的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)在i..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 $ iaryStreamToFuture.onClose(Calls.java:324)的io.grpc.Status.asRuntimeException(Status.java:428)处取消UNKNOWN。 grpc.ChannelImpl $ 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 )在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)... 1更多

引起:java.nio.channels.ClosedChannelException

BigtableHelper.getConnection()没有抛出异常,我认为它连接成功。 put语句有什么问题吗?什么可能导致这个问题?谢谢!

1 个答案:

答案 0 :(得分:0)