简体   繁体   中英

Android Amazon Web Services Unable to execute HTTP request: sdb.amazonaws.com

I have been getting the following errors when saving to the amazon SimpleDB.

My code (taken from amazon tutorial):

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

The Account class methods (getSimpleDB() and getDomain() I've tested and work. The problem is most certainly taking place in the amazon methods of createDomain() or CreateDomainRequest()

The Errors:

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

What is very strange to me is that sometimes I run the code it works, but other times, it doesn't. It seems maybe that if I change wireless networks then it stops working, though I am not sure about that theory. I have tested the code on my actual phone and never found an issue, but running it on my 2.3.3 emulator sometimes I get the following errors... but not always. Lastly, I do have the INTERNET android permission and I do currently have a working wireless connection.

Any ideas? Thanks in advance...

In your client configuration, if your service is regional, I think you need to set the endpoint desired. Did you set the end point ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM