简体   繁体   中英

Classpath conflict problem (com.google.api.client.http.HttpTransport)

I'm struggling to make my spring boot application start, it presents this error at boot:

***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
    com.google.api.services.sqladmin.SQLAdmin$Builder.chooseEndpoint(SQLAdmin.java:7296)
The following method did not exist:
    'boolean com.google.api.client.http.HttpTransport.isMtls()'
The method's class, com.google.api.client.http.HttpTransport, is available from the following locations:
    jar:file:/Users/benz/.m2/repository/com/google/http-client/google-http-client/1.35.0/google-http-client-1.35.0.jar!/com/google/api/client/http/HttpTransport.class
The class hierarchy was loaded from the following locations:
    com.google.api.client.http.HttpTransport: file:/Users/benz/.m2/repository/com/google/http-client/google-http-client/1.35.0/google-http-client-1.35.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.api.client.http.HttpTransport

Let me specify that this application has two configurations:

  • one for local development, which connects to local postgresql
  • one for running on Google cloud (AppEngine) & using Google Cloud SQL

After a big update, the Cloud profile doesn't work anymore due to this problem.

From what I read, it could be a dependency problem that must be resolved through maven.

[INFO] +- com.google.firebase:firebase-admin:jar:6.16.0:compile
[INFO] |  +- com.google.api-client:google-api-client:jar:1.30.10:compile
[INFO] |  |  +- com.google.oauth-client:google-oauth-client:jar:1.31.0:compile
[INFO] |  |  \- com.google.http-client:google-http-client-jackson2:jar:1.36.0:compile
[INFO] |  +- com.google.api-client:google-api-client-gson:jar:1.30.10:compile
[INFO] |  |  \- com.google.http-client_:google-http-client-gson:jar:1.36.0:compile
[INFO] |  +- com.google.http-client:google-http-client:jar:1.35.0:compile

As far as I can see, here's the only http-client that is repeating. I've tried to downgrade the firebase-admin library, but it's dependencies remained at the same version number.

Probably I'm doing something wrong. Does somebody have an idea on how to solve this problem? I've lost many hours...with no luck...

Thank you

This method was included in the google-http-java-client among other changes toadd support for mtls . This is the relevant commit .

This code was released on version 1.38.0 of the library.

That library version seems to be compatible with your firebase-admin version.

Please, try to include the following as a first level Maven dependency:

<dependency>
    <groupId>com.google.http-client</groupId>
    <artifactId>google-http-client</artifactId>
    <version>1.38.0</version>
</dependency>

Probably you can use a more recent version of google-http-client as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM