aws-sdk-java-v2: Conflicting Kotlin versions for DynamoDB local `1.16.0`

As indicated in the post to another issue, we are facing conflicts when using the latest DynamoDB local version 1.16.0 in a Kotlin project. The reason is that the DynamoDB local jar seems to contain a copy of the Kotlin standard lib which conflicts with the one we are using for our project. We tested this both with a 1.4.x and 1.5.x version of Kotlin and both failed. Can you please fix the setup so that we can use Kotlin and DynamoDB local, again?


@zoewangg Thanks for the information about the release of 1.16.0. We were successfully able to start an embedded DynamoDB local instance in a JUnit test. However, once we now face some compiler warning:

w: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
w: /home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar: Library has Kotlin runtime bundled into it

Moreover, all integration tests fail due to conflicting Kotlin standard library files, see the following error details:

***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
    kotlin.reflect.jvm.internal.impl.descriptors.Visibilities.<clinit>(Visibilities.kt:56)
The following method did not exist:
    'java.util.Map kotlin.collections.MapsKt.createMapBuilder()'
The method's class, kotlin.collections.MapsKt, is available from the following locations:
    jar:file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar!/kotlin/collections/MapsKt.class
    jar:file:/home/markus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.0/29dae2501ca094416d15af0e21470cb634780444/kotlin-stdlib-1.5.0.jar!/kotlin/collections/MapsKt.class
The class hierarchy was loaded from the following locations:
    kotlin.collections.MapsKt: file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar
    kotlin.collections.MapsKt___MapsKt: file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar
    kotlin.collections.MapsKt__MapsKt: file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar
    kotlin.collections.MapsKt__MapsJVMKt: file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar
    kotlin.collections.MapsKt__MapWithDefaultKt: file:/home/markus/.gradle/caches/modules-2/files-2.1/com.amazonaws/DynamoDBLocal/1.16.0/f705aa07cee4eb8199e70a393c5bd8173e7290ac/DynamoDBLocal-1.16.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of kotlin.collections.MapsKt

Can you help us with the issue or guide us towrads a collegue that can provide more information?

We are using Kotlin 1.5, AWS SDK 2, Spring Boot, Corretto 11 as JRE, Gradle. Moreover, it seems like the DynamoDB local jar contains indeed a copy of the Kotlin standard library classes/files. Is it possible to remove those from the bundle?

_Originally posted by @spanierm in https://github.com/aws/aws-sdk-java-v2/issues/982#issuecomment-843235519_

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 33
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I assume the Kotlin SDK is bundled to allow stand-alone running of the .jar? Why not create separate jars - one for inclusion as dependency, and uber-jar for stand-alone calls?

Bumping this. Still not working and this workaround is absurd. Please create a jar that is compatibile with Kotlin projects.

Any updates about this as it still happens with version 1.18.0? I got it working with the Gradle workaround above (although I also needed to exclude the DynamoDB Local JAR). However it would good if it just worked without requiring all of that as it complicates the Gradle build file.