0

保存到亚马逊 SimpleDB 时出现以下错误。

我的代码(取自亚马逊教程):

Account.getSimpleDB().createDomain(new CreateDomainRequest(Account.getDomain()));

Account 类方法(getSimpleDB() 和 getDomain() 我已经测试并工作过。问题肯定发生在 createDomain() 或 CreateDomainRequest() 的亚马逊方法中

错误:

01-30 13:35:54.645: E/AndroidRuntime(595): com.amazonaws.AmazonClientException: Unable to execute HTTP request: sdb.amazonaws.com
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.amazonaws.http.AmazonHttpClient.executeHelper(Unknown Source)
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.amazonaws.http.AmazonHttpClient.execute(Unknown Source)
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.amazonaws.services.simpledb.AmazonSimpleDBClient.invoke(Unknown Source)
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.amazonaws.services.simpledb.AmazonSimpleDBClient.createDomain(Unknown Source)
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.zbien.pizza.Account.save(Account.java:72)
01-30 13:35:54.645: E/AndroidRuntime(595):  at com.zbien.pizza.Account$1.run(Account.java:231)
01-30 13:35:54.645: E/AndroidRuntime(595): Caused by: java.net.UnknownHostException: sdb.amazonaws.com
01-30 13:35:54.645: E/AndroidRuntime(595):  at java.net.InetAddress.lookupHostByName(InetAddress.java:497)
01-30 13:35:54.645: E/AndroidRuntime(595):  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
01-30 13:35:54.645: E/AndroidRuntime(595):  at java.net.InetAddress.getAllByName(InetAddress.java:256)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
01-30 13:35:54.645: E/AndroidRuntime(595):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
01-30 13:35:54.645: E/AndroidRuntime(595):  ... 6 more

对我来说非常奇怪的是,有时我运行它可以工作的代码,但其他时候却没有。似乎如果我改变无线网络,它就会停止工作,尽管我不确定这个理论。我已经在我的实际手机上测试了代码,但从未发现问题,但在我的 2.3.3 模拟器上运行它有时会出现以下错误......但并非总是如此。最后,我确实拥有 INTERNET android 权限,并且我目前确实有一个可用的无线连接。

有任何想法吗?提前致谢...

4

1 回答 1

0

在您的客户端配置中,如果您的服务是区域性的,我认为您需要设置所需的端点。你设置了终点吗?

于 2013-11-03T00:28:03.570 回答