okhttp fails wtih java.lang.NoSuchMethodError

32 views Asked by At

I'm encountering a java.lang.NoSuchMethodError issue while using OkHttp version 4.12.0 in my Java Gradle project I have a spark Job and I am trying to upload a zip file to Minio Bucket. When I try to initialize the Minio Client, using the code below, I am getting the below error while running the job in k8s.

private val minioClient = MinioClient.builder().endpoint(minioHost).credentials(accessKey, secretKey).build();
RunTime Error: Caused by: java.lang.RuntimeException: Unsupported OkHttp library found. Must use okhttp >= 4.11.0 at io.minio.S3Base.(S3Base.java:107) ... 41 more Caused by: java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)' at io.minio.S3Base.(S3Base.java:105)

The Minio libary (io.minio:minio) has a depedency on com.squareup.okhttp3:okhttp:4.12.0.

In case of any version conflict I am forcing the 4.12.0 version in my Project. My Gradle entries:

configurations.all { resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.12.0' } implementation group: 'io.minio', name: 'minio', version: '8.5.9'

Are there any additional troubleshooting steps I could take to resolve this issue? Thanks in advance.

0

There are 0 answers