3

I successfully followed the Google Cloud Endpoints tutorial and created a project with an AppEngine using Endpoints and connected to it from an Android App. (As detailed here: https://cloud.google.com/endpoints/docs/frameworks/java/get-started-frameworks-java). I also added authentication to the application.

Then I tried to add some reading and writing to the Datastore and discovered that when I run my android app towards my local development server started like this

dev_appserver.cmd -a 0.0.0.0 .\target\echo-1.0-SNAPSHOT\

the local development server is not using the local datastore, it is using the remote cloud datastore.

I can see the Entities being created in the production datastore in the Cloud Console.

No local "local_db.bin" file is being created

I also discovered that if I disable the Datastore API in Cloud Console my local development server threw this exception, printed in the console terminal window:

aug 03, 2017 5:44:59 EM com.google.api.server.spi.SystemService invokeServiceMethod SEVERE: exception occurred while calling backend method com.google.cloud.datastore.DatastoreException: The Cloud Datastore API is not enabled for the project XXXXXXX (I edited out my project name here) at com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.translate(HttpDatastoreRpc.java:128) at com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.translate(HttpDatastoreRpc.java:113) at com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.lookup(HttpDatastoreRpc.java:163) at com.google.cloud.datastore.DatastoreImpl$4.call(DatastoreImpl.java:317) at com.google.cloud.datastore.DatastoreImpl$4.call(DatastoreImpl.java:313) at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:94) at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:54) at com.google.cloud.datastore.DatastoreImpl.lookup(DatastoreImpl.java:312) at com.google.cloud.datastore.DatastoreImpl$ResultsIterator.loadResults(DatastoreImpl.java:288) at com.google.cloud.datastore.DatastoreImpl$ResultsIterator.(DatastoreImpl.java:284) at com.google.cloud.datastore.DatastoreImpl.get(DatastoreImpl.java:274) at com.google.cloud.datastore.DatastoreImpl.get(DatastoreImpl.java:238) at com.google.cloud.datastore.DatastoreHelper.get(DatastoreHelper.java:47) at com.google.cloud.datastore.DatastoreImpl.get(DatastoreImpl.java:223)

Is my understanding correct that the local development server should use a local Datastore file and not use the remote cloud Datastore? If so, what could be causing this?

Part of the original tutorial I followed was to "deploy the endpoints configuration" (which I have not yet fully understood the meaning of) into Google Service Management by doing this:

gcloud service-management deploy openapi.json

Could that have configured something in my project causing it to use the remote Datastore API:s instead of a local Datastore?

I have also seen that there is something called a Datastore Emulator. Do I have to use that somehow in order to use a local datastore?

Aardvark
  • 61
  • 6
  • 1
    I found the answer in this question: https://stackoverflow.com/questions/40348653/google-datastore-emulator-using-java-not-using-gae – Aardvark Aug 04 '17 at 10:35

0 Answers0