Skip to content

The version of okhttp3 is not compatible #290

@chb1828

Description

@chb1828

influxdb-client-version : 4.0.0

It won't run because the version of that dependency doesn't match.
The error log is as below.

***************************
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.influxdb.client.internal.AuthenticateInterceptor.initToken(AuthenticateInterceptor.java:122)

The following method did not exist:

    'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)'

The calling method's class, com.influxdb.client.internal.AuthenticateInterceptor, was loaded from the following location:

    jar:file:/C:/.../gradle/caches/modules-2/files-2.1/com.influxdb/influxdb-client-java/4.0.0/c9b3a066f15c0bd8799936c623a8d096c86c64fd/influxdb-client-java-4.0.0.jar!/com/influxdb/client/internal/AuthenticateInterceptor.class

The called method's class, okhttp3.RequestBody, is available from the following locations:

    jar:file:/C:/.../.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.14.9/3e6d101343c7ea687cd593e4990f73b25c878383/okhttp-3.14.9.jar!/okhttp3/RequestBody.class

The called method's class hierarchy was loaded from the following locations:

    okhttp3.RequestBody: file:/C:/.../.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.14.9/3e6d101343c7ea687cd593e4990f73b25c878383/okhttp-3.14.9.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.influxdb.client.internal.AuthenticateInterceptor and okhttp3.RequestBody

Disconnected from the target VM, address: '127.0.0.1:62083', transport: 'socket'

Process finished with exit code 1

So I changed okhttp version 3.14 to version 4.9.3

build.gradle

    implementation ("com.influxdb:influxdb-client-reactive:${influxVersion}") {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor'
    }
    implementation "com.squareup.okhttp3:okhttp:4.9.3"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions