试图调用Google Vision API的ServiceAccountJwtAccessCredentials异常

问题描述 投票:0回答:1

我正在尝试评估Google愿景端点。我的pom配置如下

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-vision</artifactId>
  <version>1.69.0</version>
</dependency>

没有添加其他谷歌依赖项。我在视觉依赖本身中看到了下面的冲突。 enter image description here

当我运行代码时,我遇到了错误。

GoogleAuthLibraryCallCredentials#createJwtHelperOrNull#229 - Failed to create JWT helper. This is unexpected
java.lang.NoSuchMethodException: com.google.auth.oauth2.ServiceAccountJwtAccessCredentials.<init>(java.lang.String, java.lang.String, java.security.PrivateKey, java.lang.String)
at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_202]
at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_202]

我相信这与不匹配的版本有关。但不知道使用哪一个以及如何在同一个jar中修复依赖问题。

java maven google-vision
1个回答
1
投票

这是最近版本的SDK中引入的错误。它影响了几个Google Cloud Java SDK。我在pubsub客户端遇到了类似的问题。作为解决方法,使用版本1.67.0应该使您的代码正常工作。

这是我打开的错误报告:

https://github.com/googleapis/google-cloud-java/issues/4946

© www.soinside.com 2019 - 2024. All rights reserved.