简体   繁体   English

com.google.api.client库中的NoSuchMethodError

[英]NoSuchMethodError in com.google.api.client library

I'm trying to use the Google Cloud Storage SDK for Java into my Spring application. 我正在尝试将Spring Java应用程序使用Java的Google Cloud Storage SDK。

Using Maven I've added it to my dependencies: 使用Maven,我已将其添加到我的依赖项中:

<dependency>
   <groupId>com.google.cloud</groupId>
   <artifactId>google-cloud-storage</artifactId>
   <version>1.31.0</version>
</dependency> 

Then I try to initialize the Storage client with: 然后,我尝试使用以下方法初始化存储客户端:

 client = StorageOptions.newBuilder()
                    .setCredentials(ServiceAccountCredentials.fromStream(new ClassPathResource("/my/path/to.json").getInputStream()))
                    .build()
                    .getService();

but an error occurs 但是发生错误

java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath

I've noticed that in my google-api-client-1.23.0.jar libray loaded as dependency no setBatchPath was present. 我注意到在我的google-api-client-1.23.0.jar libray中加载为依赖项时,没有setBatchPath存在。

I've tried to find the issue browsing on web but without fortune. 我试图找到在网络上浏览却没有运气的问题。 I cannot understand which library (and version) I need to install in order to make it works. 我无法理解我需要安装哪个库(和版本)才能使其正常工作。

Thanks in advance. 提前致谢。

Eventually I solved, there was a library duplication between my Web Application and Its Business Layer Jar component (I have a multi-module Project). 最终,我解决了,在我的Web应用程序及其业务层Jar组件(我有一个多模块项目)之间存在一个库重复。

What I cannot understand is why there was a call to a non-existing method ( AbstractGoogleJsonClient$Builder.setBatchPath ) that was solved in this way. 我不明白的是为什么有一个这样的方法解决了对不存在的方法( AbstractGoogleJsonClient$Builder.setBatchPath )的调用。

In google-api-client-1.20.0.jar that method does not exists nor in google-api-client-1.23.0.jar google-api-client-1.20.0.jar ,该方法不存在,在google-api-client-1.23.0.jar中也不存在

尝试阅读this ,然后您可能可以解决该错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入的com.google.api.client无法在Eclipse中解析 - The import com.google.api.client cannot be resolved in Eclipse 谷歌驱动器dredit错误java.lang.NoSuchMethodError:com.google.api.client.http.HttpRequestFactory.buildRequest - google drive dredit error java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequestFactory.buildRequest java.lang.NoSuchMethodError:com.google.api.client.http.javanet.NetHttpTransport。<init> (Lcom/google/api/client/http/javanet/ConnectionFactory; - java.lang.NoSuchMethodError: com.google.api.client.http.javanet.NetHttpTransport.<init>(Lcom/google/api/client/http/javanet/ConnectionFactory; java.lang.NoSuchMethodError:com.google.api.client.http.HttpRequest.setParser - java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setParser java.lang.NoSuchMethodError: 'boolean com.google.api.client.http.HttpTransport.isMtls() - java.lang.NoSuchMethodError: 'boolean com.google.api.client.http.HttpTransport.isMtls() java.lang.NoSuchMethodError: com.google.api.client.http.HttpTransport.isMtls()Z - java.lang.NoSuchMethodError: com.google.api.client.http.HttpTransport.isMtls()Z NoSuchMethodError:com.google.appengine.api.memcache.ErrorHandlers.getConsistentLogAndContinue - NoSuchMethodError: com.google.appengine.api.memcache.ErrorHandlers.getConsistentLogAndContinue java.lang.NoSuchMethodError:com.google.gdata.client.media.MediaService.insert(MediaService.java:318) - java.lang.NoSuchMethodError:com.google.gdata.client.media.MediaService.insert(MediaService.java:318) Google Drive API Java客户端库日志记录 - Google Drive API Java Client Library Logging 带有Google API客户端库的Http请求 - Http Request with Google API client library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM