'ClassNotFoundException using localstack and aws sdk v2 withs3

I am trying to implement s3 using localstack using aws sdk 2

Caused by: java.lang.ClassNotFoundException: com.amazonaws.auth.AWSCredentials

Gradle

    implementation "org.testcontainers:localstack:1.16.0"
    implementation "org.testcontainers:testcontainers:1.16.0"
    implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
    implementation 'com.amazonaws:aws-java-sdk-s3'*/
    implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.32'
    implementation group: 'software.amazon.awssdk', name: 's3', version: '2.17.59'

The exception goes away by replacing the library with version 1 for aws sdk, can anyone please help and advise on the same.



Solution 1:[1]

I am looking for a solution too. The only way I could solve this is by adding the aws-core v1 dependency, but that's not clean.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abderrahmane Kaci Aissa