我已经提交了googlebatchtranslation并获得了operationid(projects//locations/us-central1/operations/)。
现在我想通过池来检查此操作的状态。这里我用了下面的依赖项
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>1.58.2</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>1.58.2</version>
</dependency>
在java类中添加了以下代码:
GoogleCredentials credentials = GoogleCredentials
.fromStream(new ByteArrayInputStream(serviceKey.getBytes()))
.createScoped(Lists.newArrayList("https://clicktime.symantec.com/3TWFMHceuuMgwf8KebwWinm7Vc?u=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%2522%29%29%3B
OperationsSettings operationsSettings = OperationsSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build();
OperationsClient operationsClient = OperationsClient.create(operationsSettings);
但是在这里,我在尝试创建operationsclient时遇到了nullpointerexception
at com.google.longrunning.stub.OperationsStubSettings.createStub(OperationsStubSettings.java:107)
at com.google.longrunning.OperationsClient.<init>(OperationsClient.java:143)
at com.google.longrunning.OperationsClient.create(OperationsClient.java:125)
进一步调查发现,创建的operationssettings将transportchannelprovider设置为null。
请指导我,我在创建operationsettings/operationclient时是否遗漏了什么?在java中查找google长时间运行操作状态的最佳方法是什么。
谢谢,兰Git·库马尔
暂无答案!
目前还没有任何答案,快来回答吧!