我正在尝试设置交流发电机来开发基于 DynamoDB 的应用程序,但在尝试建立连接时出现此错误:我提供了以下项目的代码、错误和 pom.xml。交流发电机作为独立服务运行。
我正在使用已弃用的 Amazon SDK,因为 Alternator DB 客户端似乎不接受来自新 SDK com.amazonaws.services.dynamodbv2 的对象
顺便说一句,我对 Amazon 和 Maven 完全陌生。如果提供的描述不充分或不具体,请指出。谢谢!
源代码:
this.client = new AlternatorDBClient();
// Create a table with a primary key named 'name', which holds a string
ProvisionedThroughput thorughput = new ProvisionedThroughput().withReadCapacityUnits(10L).withWriteCapacityUnits(5L);
KeySchemaElement schemaElement = new KeySchemaElement().withAttributeName("Name").withAttributeType("String");
CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(TOPIC_TABLE).withProvisionedThroughput(thorughput);
client.createTable(createTableRequest);
错误:
Exception in thread "main" AmazonServiceException: Status Code: 400, AWS Service: AmazonDynamoDB, AWS Request ID: null, AWS Error Code: AmazonServiceException, AWS Error Message: [java.lang.Error: property value is null.]
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:644)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:338)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:190)
at com.michelboudreau.alternator.AlternatorDBClient.invoke(AlternatorDBClient.java:212)
at com.michelboudreau.alternator.AlternatorDBClient.createTable(AlternatorDBClient.java:137)
at Main.run(Main.java:35)
at Main.main(Main.java:23)
这是项目中的 pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.project</groupId>
<artifactId>AlternatorTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>AlternatorTest</name>
<dependencies>
<dependency>
<groupId>com.michelboudreau</groupId>
<artifactId>alternator</artifactId>
<version>0.5.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.4.4.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<id>sonatype-nexus</id>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories>