0

I'm trying to extract my Google Sheet information from my Spring Boot application, but I got the error

Exception in thread "main" java.lang.NoSuchMethodError: 'long com.google.common.io.ByteStreams.exhaust(java.io.InputStream)'

I already added all the necessary dependencies I think I need and I'm still getting the error when I run my program.

Some of the dependencies that I am using are these ones:

google-oauth-client
google-oauth-client-java
google-oauth-client-jetty
google-api-client
google-http-client
google-http-client-jackson2
google-api-services-sheets-v4

My biggest doubt is that when I use the same code in a Maven project, it runs successfully. But when I try to integrate the same code in a Spring Boot project I got the previous error. So, why?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • 1
    Does this answer your question? [java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J](https://stackoverflow.com/questions/61597801/java-lang-nosuchmethoderror-com-google-common-io-bytestreams-exhaustljava-io-i) – Jayzb73 Dec 23 '21 at 18:33
  • In which dependency this method `com.google.common.io.ByteStreams.exhaust` exists? Yes please check this answer https://stackoverflow.com/a/61600538/578855 under the stackoverflow post shared by @Jayzb73 – muasif80 Dec 23 '21 at 18:45
  • Something being a Spring Boot project or a Maven project are orthogonal concerns. You can build a Spring Boot project with Maven, Gradle or another tool. – Mark Rotteveel Dec 24 '21 at 14:56

1 Answers1

0

You can explore dependency hierarchy of your pom.xml and find which dependency is overriding com.google.common.io groupid, when you are working with spring boot project. And then exclude that specific dependency.

Similar solution you can find in below question. Here is the link: Refer this

Jayzb73
  • 32
  • 4