rynop / dynamodb-local

A wrapper for AWS DynamoDB Local, intended for use in testcases
MIT License
53 stars 30 forks source link

Docker support #39

Open lielran opened 4 years ago

lielran commented 4 years ago

instead of using the Jar version, use the docker version of DynamoDBLocal

mrattner commented 4 years ago

Having an option to use the Docker version would be a nice feature to have, and could help avoid problems like this one...


In the last couple of days, Java errors started cropping up for us when we ran DynamoDB Local:

WARNING: [sqlite] SQLiteDBAccess$20@4039bc23: job exception
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess$20.doWork(SQLiteDBAccess.java:2109)
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess$20.doWork(SQLiteDBAccess.java:2010)
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.AmazonDynamoDBOfflineSQLiteJob.job(AmazonDynamoDBOfflineSQLiteJob.java:117)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 10 more

It's almost certainly due to the .jar from AWS having been updated recently (the latest .jar at the time of this writing seems to have been updated 6 days ago), becoming incompatible with the JREs installed on our environments. I tried downgrading from openjdk-11 to openjdk-8 on my own environment, and it was A-OK again.

For anyone encountering the same issue, you can either: use the Docker DynamoDBLocal container instead of the .jar; downgrade your environment's JRE; or look at this document tree of older DynamoDB.jar download links, grab one of the older .jars that you know works with your JRE, and use that one instead of the latest from Amazon. Hope that might help someone.