7

after using minio as instructions and fixing it with ways below, I failed.what can i do to solve this bug

        <dependency>
        <groupId>io.minio</groupId>
        <artifactId>minio</artifactId>
        <version>8.3.5</version>
        <exclusions>
            <exclusion>
                <artifactId>okhttp</artifactId>
                <groupId>com.squareup.okhttp3</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>4.9.3</version>
    </dependency>
</dependencies>
sexy_Robber
  • 89
  • 1
  • 6

1 Answers1

4

I also experienced this issues with io.minio:minio:8.3.6, but was able to force a newer version of okhttp, which works with the MinIO client library. Here is the snippet of build.gradle (should work similar with Maven):

implementation("io.minio:minio:8.3.6")    
implementation("com.squareup.okhttp3:okhttp:4.9.3")

In my case it was probably caused by spring-boot-dependencies coming with the spring dependency plugin, which manages a lot of dependencies containing also okhttp and thus forces the downgrade.

See also:

Update

With Spring Boot 2.7.0, the fix is no longer required, since the version requirements for okhttp have been updated. The MinIO dependency should work now out of the box.

sdm4n
  • 121
  • 7
  • 1
    thanks a lot, I've solved this issue! – sexy_Robber Feb 15 '22 at 09:59
  • Hi, will it have problems since this method violates the spring boot dependencies? – ch271828n Apr 16 '22 at 06:33
  • I just tried it with Spring Boot `2.6.6` combined with MinIO `8.3.8` and it still works without problems using the described method. – sdm4n Apr 18 '22 at 09:27
  • Hi, I have tried with above specified to connect minio azure s3 bucker using springboot 2.7.8 combined with Minio 8.3.6. i'm getting null object. below is my code can any one suggest what wrong i'm doing here. ` MinioClient client = MinioClient.builder() .endpoint(HttpUrl.parse(minioUrl)) //.httpClient(httpClient) .credentials(accessKey, accessSecret) .build(); ` – Santhoo Kumar Feb 07 '23 at 11:34