Skip to content

Unsupported OkHttp library found. Must use okhttp >= 4.8.1 #1298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ruempel opened this issue Feb 9, 2022 · 8 comments
Closed

Unsupported OkHttp library found. Must use okhttp >= 4.8.1 #1298

ruempel opened this issue Feb 9, 2022 · 8 comments

Comments

@ruempel
Copy link

ruempel commented Feb 9, 2022

I use MinIO 8.3.6 in a Gradle-based Spring Boot project. When building the client with MinioClient.builder().endpoint(ENDPOINT).credentials(ACCESS_KEY, SECRET_KEY).build();, the following dependency exception occurs:

Caused by: java.lang.RuntimeException: Unsupported OkHttp library found. Must use okhttp >= 4.8.1
	at io.minio.S3Base.<clinit>(S3Base.java:100)

Workaround

You can force okhttp to be used in a newer version (com.squareup.okhttp3:okhttp:4.9.3 works), but the proper version should be satisfied out of the box.

@balamurugana
Copy link
Member

According to Upgrading to OkHttp 4, okhttp 4 is backward compatible. As development of okhttp 3 is stopped, it is hard to support new features and fixes. This check is done in prior to fail early than later in the middle.

@harshavardhana
Copy link
Member

You can force okhttp to be used in a newer version (com.squareup.okhttp3:okhttp:4.9.3 works), but the proper version should be satisfied out of the box.

There are no such free lunches, we want to make sure newer Jar is used when appropriate if you want to stick to okhttp 3.x use an older version of this SDK.

If you upgrade you are advised to upgrade the necessary dependencies as well.

@ruempel
Copy link
Author

ruempel commented Feb 9, 2022

Strange, I can see no other constraints on okhttp when showing gradle dependencies, but it selects okhttp in version 3.14.9 instead of 4.8.1.

\--- io.minio:minio:8.3.6
     +--- com.carrotsearch.thirdparty:simple-xml-safe:2.7.1
     +--- com.google.guava:guava:30.1.1-jre
     |    +--- com.google.guava:failureaccess:1.0.1
     |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     |    +--- com.google.code.findbugs:jsr305:3.0.2
     |    +--- org.checkerframework:checker-qual:3.8.0
     |    +--- com.google.errorprone:error_prone_annotations:2.5.1
     |    \--- com.google.j2objc:j2objc-annotations:1.3
     +--- com.squareup.okhttp3:okhttp:4.8.1 -> 3.14.9
     |    \--- com.squareup.okio:okio:1.17.2

@harshavardhana
Copy link
Member

@balamurugana if we fail during init() should not make it an explicit dependency change in build.gradle itself instead of failing after compilation?

@harshavardhana harshavardhana reopened this Feb 9, 2022
@balamurugana
Copy link
Member

Below is the dependency tree of minio-java.


[bala@fedora minio-java]$ ./gradlew :api:dependencies -console plain 

> Task :api:dependencies

------------------------------------------------------------
Project :api
------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies

apiElements - API elements for main. (n)
No dependencies

archives - Configuration for archive artifacts. (n)
No dependencies

compileClasspath - Compile classpath for source set 'main'.
+--- com.carrotsearch.thirdparty:simple-xml-safe:2.7.1
+--- com.google.guava:guava:30.1.1-jre
|    +--- com.google.guava:failureaccess:1.0.1
|    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- org.checkerframework:checker-qual:3.8.0
|    +--- com.google.errorprone:error_prone_annotations:2.5.1
|    \--- com.google.j2objc:j2objc-annotations:1.3
+--- com.squareup.okhttp3:okhttp:4.8.1
|    +--- com.squareup.okio:okio:2.7.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
|    |    |    \--- org.jetbrains:annotations:13.0
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
+--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
+--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- com.fasterxml.jackson.core:jackson-databind:2.11.2
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
|    \--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- org.bouncycastle:bcprov-jdk15on:1.69
+--- org.apache.commons:commons-compress:1.21
+--- org.xerial.snappy:snappy-java:1.1.8.4
\--- com.github.spotbugs:spotbugs-annotations:4.1.2
     \--- com.google.code.findbugs:jsr305:3.0.2

compileOnly - Compile only dependencies for source set 'main'. (n)
\--- com.github.spotbugs:spotbugs-annotations:4.1.2 (n)

default - Configuration for default artifacts. (n)
No dependencies

implementation - Implementation only dependencies for source set 'main'. (n)
No dependencies

javadocElements - javadoc elements for main. (n)
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
+--- com.carrotsearch.thirdparty:simple-xml-safe:2.7.1
+--- com.google.guava:guava:30.1.1-jre
|    +--- com.google.guava:failureaccess:1.0.1
|    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- org.checkerframework:checker-qual:3.8.0
|    +--- com.google.errorprone:error_prone_annotations:2.5.1
|    \--- com.google.j2objc:j2objc-annotations:1.3
+--- com.squareup.okhttp3:okhttp:4.8.1
|    +--- com.squareup.okio:okio:2.7.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
|    |    |    \--- org.jetbrains:annotations:13.0
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
+--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
+--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- com.fasterxml.jackson.core:jackson-databind:2.11.2
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
|    \--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- org.bouncycastle:bcprov-jdk15on:1.69
+--- org.apache.commons:commons-compress:1.21
\--- org.xerial.snappy:snappy-java:1.1.8.4

runtimeElements - Elements of runtime for main. (n)
No dependencies

runtimeOnly - Runtime only dependencies for source set 'main'. (n)
No dependencies

shadow
No dependencies

shadowRuntimeElements (n)
No dependencies

signatures
No dependencies

sourcesElements - sources elements for main. (n)
No dependencies

spotbugs - configuration for the SpotBugs engine
\--- com.github.spotbugs:spotbugs:4.1.1
     +--- jaxen:jaxen:1.1.6
     +--- net.sf.saxon:Saxon-HE:10.1
     +--- org.ow2.asm:asm:8.0.1
     +--- org.ow2.asm:asm-analysis:8.0.1
     |    \--- org.ow2.asm:asm-tree:8.0.1
     |         \--- org.ow2.asm:asm:8.0.1
     +--- org.ow2.asm:asm-commons:8.0.1
     |    +--- org.ow2.asm:asm:8.0.1
     |    +--- org.ow2.asm:asm-tree:8.0.1 (*)
     |    \--- org.ow2.asm:asm-analysis:8.0.1 (*)
     +--- org.ow2.asm:asm-tree:8.0.1 (*)
     +--- org.ow2.asm:asm-util:8.0.1
     |    +--- org.ow2.asm:asm:8.0.1
     |    +--- org.ow2.asm:asm-tree:8.0.1 (*)
     |    \--- org.ow2.asm:asm-analysis:8.0.1 (*)
     +--- org.apache.bcel:bcel:6.5.0
     +--- net.jcip:jcip-annotations:1.0
     +--- org.dom4j:dom4j:2.1.3
     +--- org.apache.commons:commons-lang3:3.11
     +--- org.apache.commons:commons-text:1.9
     |    \--- org.apache.commons:commons-lang3:3.11
     +--- org.slf4j:slf4j-api:1.8.0-beta4
     +--- com.github.spotbugs:spotbugs-annotations:4.1.1
     |    \--- com.google.code.findbugs:jsr305:3.0.2
     \--- org.json:json:20200518

spotbugsPlugins - configuration for the external SpotBugs plugins
No dependencies

spotbugsSlf4j - configuration for the SLF4J provider to run SpotBugs
\--- org.slf4j:slf4j-simple:1.8.0-beta4
     \--- org.slf4j:slf4j-api:1.8.0-beta4

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies

testCompileClasspath - Compile classpath for source set 'test'.
+--- com.carrotsearch.thirdparty:simple-xml-safe:2.7.1
+--- com.google.guava:guava:30.1.1-jre
|    +--- com.google.guava:failureaccess:1.0.1
|    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- org.checkerframework:checker-qual:3.8.0
|    +--- com.google.errorprone:error_prone_annotations:2.5.1
|    \--- com.google.j2objc:j2objc-annotations:1.3
+--- com.squareup.okhttp3:okhttp:4.8.1
|    +--- com.squareup.okio:okio:2.7.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
|    |    |    \--- org.jetbrains:annotations:13.0
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
+--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
+--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- com.fasterxml.jackson.core:jackson-databind:2.11.2
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
|    \--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- org.bouncycastle:bcprov-jdk15on:1.69
+--- org.apache.commons:commons-compress:1.21
+--- org.xerial.snappy:snappy-java:1.1.8.4
+--- com.squareup.okhttp3:mockwebserver:4.8.1
|    +--- com.squareup.okhttp3:okhttp:4.8.1 (*)
|    \--- junit:junit:4.13
|         \--- org.hamcrest:hamcrest-core:1.3
\--- junit:junit:4.13 (*)

testCompileOnly - Compile only dependencies for source set 'test'. (n)
No dependencies

testImplementation - Implementation only dependencies for source set 'test'. (n)
+--- com.squareup.okhttp3:mockwebserver:4.8.1 (n)
\--- junit:junit:4.13 (n)

testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- com.carrotsearch.thirdparty:simple-xml-safe:2.7.1
+--- com.google.guava:guava:30.1.1-jre
|    +--- com.google.guava:failureaccess:1.0.1
|    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- org.checkerframework:checker-qual:3.8.0
|    +--- com.google.errorprone:error_prone_annotations:2.5.1
|    \--- com.google.j2objc:j2objc-annotations:1.3
+--- com.squareup.okhttp3:okhttp:4.8.1
|    +--- com.squareup.okio:okio:2.7.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
|    |    |    \--- org.jetbrains:annotations:13.0
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
+--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
+--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- com.fasterxml.jackson.core:jackson-databind:2.11.2
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.2 -> 2.9.6
|    \--- com.fasterxml.jackson.core:jackson-core:2.11.2
+--- org.bouncycastle:bcprov-jdk15on:1.69
+--- org.apache.commons:commons-compress:1.21
+--- org.xerial.snappy:snappy-java:1.1.8.4
+--- com.squareup.okhttp3:mockwebserver:4.8.1
|    +--- com.squareup.okhttp3:okhttp:4.8.1 (*)
|    \--- junit:junit:4.13
|         \--- org.hamcrest:hamcrest-core:1.3
\--- junit:junit:4.13 (*)

testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
No dependencies

(*) - dependencies omitted (listed previously)

(n) - Not resolved (configuration is not meant to be resolved)

A web-based, searchable dependency report is available by adding the --scan option.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 493ms
1 actionable task: 1 executed
[bala@fedora minio-java]$ 

The project which is using minio-java should not force to use okhttp v3. As okhttp v4 is backward compatible to okhttp 3, jars those depends on okhttp v3 works according to Upgrading to OkHttp 4

@ruempel
Copy link
Author

ruempel commented Feb 9, 2022

Since I use the io.spring.dependency-management Gradle plugin, https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/2.6.3 may force okhttp to "downgrade" to version 3.14.9, which causes MinIO to complain.

@LeonSC
Copy link

LeonSC commented Feb 10, 2022

I think MAVEN has problem.
I edit pom like below.
<dependency> <groupId>io.minio</groupId> <artifactId>minio</artifactId> <version>8.3.6</version> <exclusions> <exclusion> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> </exclusion> </exclusions> </dependency> <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp --> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>4.8.1</version> </dependency>
I still have wave on <version>4.8.1</version> and still print out Unsupported OkHttp library found. Must use okhttp >= 4.8.1.
I checked Maven Dependencies, and it is 4.8.1.
I have worked on this for all moring and bloom now.
PLZ help...........

@jokechen102
Copy link

I think MAVEN has problem. I edit pom like below. <dependency> <groupId>io.minio</groupId> <artifactId>minio</artifactId> <version>8.3.6</version> <exclusions> <exclusion> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> </exclusion> </exclusions> </dependency> <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp --> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>4.8.1</version> </dependency> I still have wave on <version>4.8.1</version> and still print out Unsupported OkHttp library found. Must use okhttp >= 4.8.1. I checked Maven Dependencies, and it is 4.8.1. I have worked on this for all moring and bloom now. PLZ help...........

I got the same problem, could any body help me ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants