Open Max161 opened 3 years ago
I'm not familiar with Play Framework, but my guess would be that Play's architecture (from what I read in their website) relies in Java reflection, and this may not work very well with DynamoDB Enhanced Client's underlying structure.
I'll investigate a little more, but right now I'm leaning towards changing this to a feature request.
We've checked further for the issue and it seems out that DynamoDB, internally, is using Class.forName. As per this thread, it's not a good practice. It means that the library is looking for the class's definition and won't find it.
As a temporary workaround, you can take your dynamoDB models and include them as a separated library (jar). That way the classloader will find the right path to the class.
Hope you could fix it
Thx for providing a workaround @Max161. I must admit though, that it feels rather awkward to provide a separate jar for the models.
I hope this will be fixed soon 👍
Thx for providing a workaround @Max161. I must admit though, that it feels rather awkward to provide a separate jar for the models.
I hope this will be fixed soon
Dear @u6f6o I know. I don't like it either. But, afaik, this is the only way to not be bothered by this bug atm.
It's been a year and it's still an issue :(
When using DynamoDB version 2.15.41, but even the older versions, with the play framewok 2.8 (java) it throws a NoClassDefFoundError when you set the Table Schema via annotated class or via bean.
Describe the bug
I'm trying to create a simple registration/login application with the support of DynamoDB and Play Framework with java. I downloaded the last play java seed from the official site and added the dependencies for DynamoDb and DynamoDB enhanced v. 2.15.41.
I wrote some simple API's to call Create - Put - Get for the items. But I'm not able to put or get items from the table
What I mean is that if I define a table as following it will throw a NoClassDefFound when used:
Expected Behavior
I should be able to put and get items correctly.
Current Behavior
When you run this code it's going to throw the exception.
Steps to Reproduce
A public repository with the code could be found here: https://github.com/Max161/AWS_DynamoDB_ClassNotFound_Error
To run the code use sbt run command in the main folder. Than you can use postman to call the API: /createtable /getItem /putItem
Your Environment