I am creating an android application with an app engine back end. I used the google app engine plugin to create an android connected app. Here is my entity.
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Long id;
@Persistent
String email;
@Persistent
String password;
I used the plugin to generate my endpoint. To test it, I run the app engine as a web application and I can use every method successfully. I navigate to
http://localhost:8888/_ah/admin/datastore
and I can see the records that I entered. To be sure the generated getUser method works I go to the API explorer and retrieve user with id = 1 and I get
{
"id": "1",
"email": "this@that.com",
"password": "1234"
}
So I know it works. In my android app I connect to the endpoint like this:
User user = new User();
Userendpoint.Builder endpointBuilder = new Userendpoint.Builder(AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new HttpRequestInitializer() {
public void initialize(HttpRequest httpRequest) {
}
});
Userendpoint endpoint = CloudEndpointUtils.updateBuilder(endpointBuilder).build();
try {
User result = endpoint.getUser(1L).execute();
} catch (IOException e) {
e.printStackTrace();
}
And I get the following error
com.google.api.client.googleapis.json.GoogleJsonResponseException: 503 Service Unavailable
{
"code" : 503,
"errors" : [ {
"domain" : "global",
"message" : "javax.jdo.JDOObjectNotFoundException: Could not retrieve entity of kind User with key User(1)\nNestedThrowables:\norg.datanucleus.exceptions.NucleusObjectNotFoundException: Could not retrieve entity of kind User with key User(1)",
"reason" : "backendError"
} ],
Any advice or ideas would be greatly appreciated!