Issue
Getting this below error,
java.lang.NoClassDefFoundError: software/amazon/awssdk/core/runtime/transform/Unmarshaller
When executing the below code,
@Test
public void testStateFunction() {
SfnClient sfnClient = SfnClient.create();
System.out.println(sfnClient);
}
Have the below dependencies defined in build.gradle
dependencies {
implementation platform('software.amazon.awssdk:bom:2.17.29')
// implementation group: 'software.amazon.awssdk', name: 'core', version: '2.17.29', ext: 'pom'
implementation 'software.amazon.awssdk:core:2.17.29'
// implementation 'software.amazon.awssdk:aws-core:2.17.29'
// implementation 'software.amazon.awssdk:sdk-core:2.17.29'
implementation 'software.amazon.awssdk:s3'
implementation 'software.amazon.awssdk:stepfunctions:2.0.0-preview-11'
implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
implementation 'com.amazonaws:aws-lambda-java-events:3.10.0'
runtimeOnly 'com.amazonaws:aws-lambda-java-log4j2:1.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.logging.log4j:log4j-api:2.13.0'
implementation 'org.apache.logging.log4j:log4j-core:2.13.0'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j18-impl:2.13.0'
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
}
Tried many online searches, can't fix it yet.
From the InteliJ left menu Gradle libraries, when I try to expand sdk-core, cannot find the class software/amazon/awssdk/core/runtime/transform/Unmarshaller in any jars.
Solution
After further investigation found out that
The right latest dependency is
implementation 'software.amazon.awssdk:sfn:2.17.29'
And seems the below one which I tried initially was outdated and hence it did not worked with AWS 2.0 core jar /Unmarshaller which does not exist.
Reference: https://github.com/aws/aws-sdk-java-v2/issues/2094 Thanks
implementation 'software.amazon.awssdk:stepfunctions:2.0.0-preview-11'
Answered By - Jay
Answer Checked By - Cary Denson (JavaFixing Admin)