我正在尝试使用 dynamo db 运行样板代码。我正在使用 maven shade 并且在编译时一切正常,但我java.lang.NoClassDefFoundError: software/amazon/awssdk/services/dynamodb/DynamoDbClient
在运行时得到了。我花了至少 5 个小时尝试不同版本的 sdk,但没有任何帮助。我可以在 Intellije 的外部库区域中看到该库。
错误:
java.lang.NoClassDefFoundError:软件/amazon/awssdk/services/dynamodb/DynamoDbClient
Pom.xml https://pastebin.com/wwaTm8yq
导致错误的代码:
DynamoDbClient ddb = DynamoDbClient.builder().build();
Map<String, AttributeValue> item = new HashMap<>();
item.put("uuid", AttributeValue.builder().s("test").build());
ddb.putItem(PutItemRequest.builder().item(item).build());