-
Notifications
You must be signed in to change notification settings - Fork 909
dynamodb-enhanced cannot be used with GraalVM 21.1 #2445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @Aleksandr-Filichkin thanks for reporting the issue. We will investigate to see if we can fix it for Test code: Lines 39 to 62 in 8763931
|
Thank you @zoewangg ! |
Hello! I looked into this issue and found out that the error message is misleading. The problem has nothing to do with My solution to this problem currently is to substitute the use of the LambdaMetafactory for the native-image with a MethodHandle and an inner class which seems to work fine (minus the likely performance hit). While trying to fix this particular problem I stumbled upon another issue with the LambdaToMethodBridgeBuilder. It uses the Lookup wrong and crashes if the bean class is loaded in a different classloader than the AWS SDK, but this is probably better dicussed in another issue. I have made a proof of concept as quarkus extension which at least seems to work for my very basic test case https://github.com/Nithanim/quarkus-dynamodb-enhanced. |
As a workaround, I've been able to use StaticTableSchema for mapping simple objects, but run into issues when mapping more complex attributes. For example, how would I map something like this using StaticTableSchema? Please note,
|
Assume this is still an issue? I'm looking to convert a project using DynamoDB mapper, but used the Java SDK v1. I want to move it to GraalVM and it seems v2 SDK is the only option. The open question about creating tables seems to be the only concern, but I'm not sure if it actually blocks anything. @deandelponte did you find a workaround? I haven't really explored SDK 2, but I had a similar mapping where
Is your example different? If not, I think it would simply leave out CustomerOrgData from the schema altogether. But I don't know if the BeanTableSchema is doing something special for collections. |
Hi, @madeupname this link was a pretty good reference that helped me out https://stackoverflow.com/questions/71573650/nested-beans-with-statictableschema-enhanced-dynamodb-client-from-aws-java-sdk |
Has anyone found any solution to this? :( |
Has anyone found any solution to this? |
Any solution??? |
switching to StaticTableSchema as suggested above worked for me |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm trying to compile dynamodb-enhanced client with Graalvm 21.1 and awssdk.version=2.16.50
Here the code:
DynamoDbTable<Book> dynamoDbTable = dynamoDbEnhancedClient.table(TABLE_NAME, TableSchema.fromBean(Book.class));
Reflection config doesn't help. I generated native-image artifacts with -agentlib: but it still doesn't help.
GraalVM 21.1 supports Method Handler, I hope it can be fixed.
https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/internal/mapper/LambdaToMethodBridgeBuilder.java#L76
Error:
Exception in thread "main" java.lang.ExceptionInInitializerError at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315) Caused by: java.lang.IllegalArgumentException: Failed to generate method handle. at software.amazon.awssdk.enhanced.dynamodb.internal.mapper.LambdaToMethodBridgeBuilder.build(LambdaToMethodBridgeBuilder.java:92) at software.amazon.awssdk.enhanced.dynamodb.internal.mapper.ObjectConstructor.create(ObjectConstructor.java:37) at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.newObjectSupplierForClass(BeanTableSchema.java:361) at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.createStaticTableSchema(BeanTableSchema.java:172) at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.create(BeanTableSchema.java:129) at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.create(BeanTableSchema.java:121) at software.amazon.awssdk.enhanced.dynamodb.TableSchema.fromBean(TableSchema.java:81) at com.filichkin.blog.lambda.v3.handler.test.Main.initDispatcher(Main.java:39)
No problem with simple dynamoDb client, it can be compiled with GraalVM
The text was updated successfully, but these errors were encountered: