0

I am trying to run a Google App Engine Java application locally. I have installed the Cloud Tools for Eclipse and configured my project and the project starts OK.

I also see the Datastore Admin.

However, I don't see how I can import Datastore entities into Datastore Admin in Eclipse. I tried to follow the same instructions as for importing the entities into local emulator, however the import does not happen.

I can run the emulator using gcloud and import data there, however my app running in Eclipse does not seem to work with that emulator.

So two questions:

  1. Can I configure Eclipse to use the gcloud Datastore emulator instead of running one separately?

  2. Can I import Datastore entities into Eclipse run emulator?

Daniel Ocando
  • 3,554
  • 2
  • 11
  • 19

1 Answers1

0
  1. Cloud Tools for Eclipse doesn't include an explicit separate emulator. In order to use the Datastore Emulator please refer to the following section of the documentaiton in order to understand how to run it and this section to understand how to export and import emulator data. Notice that you just basically need to send an HTTP request (more specifically a POST request in the case of importing entities) with either a curl or a similar command.

  2. To interact with the Datastore instance (import entities, export entities, etc.) in a local server you can either use the Cloud Client Libraries for Java or third-party libraries like Objectify. Follow this section of the documentation to configure Eclipse to use the Cloud Client Libraries in a Local Server. And an example of how to use it here Follow this part of the documentation in order to configure Objectify when running applications locally, and all the relevant examples on how to load, save and delete data here.

Daniel Ocando
  • 3,554
  • 2
  • 11
  • 19
  • So essentially the answer to both my questions in NO. What you are suggesting is I use Google Cloud Datastore from my Google Cloud Project. This is not very efficient at all. – Vishakha Kulkarni Dec 27 '19 at 05:45
  • The [solution](https://cloud.google.com/eclipse/docs/objectify) suggested switches [the bundled datastore emulator](https://cloud.google.com/datastore/docs/tools/datastore-emulator) and uses the gcloud-based emulator and a third party library ([Objectify](https://github.com/objectify/objectify)) for entities manipulation. – Daniel Ocando Dec 27 '19 at 08:53
  • In my application, we do not use Objectity, we directly use the Datastore APIs. So this does not work. – Vishakha Kulkarni Dec 27 '19 at 10:02
  • Notice [here](https://cloud.google.com/eclipse/docs/objectify#switching_datastore_emulator) that all what is required is to use a library that supports the `DATASTORE_EMULATOR_HOST environment variable` which is the case for the [Java Client Library](https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/datastore/package-summary.html). If the env variable is set, then your application will look for the emulator and not the Datastore instance hosted on GCP. – Daniel Ocando Dec 27 '19 at 15:28
  • So i tried this and does not work. I am not sure, if it is using the emulator or the local datastore emulator running in eclipse. How do i verify this? I am using com.google.appengine appengine-api-1.0-sdk 1.9.74 in my POM. Do I need to use the datastore client specifically for this to work? – Vishakha Kulkarni Dec 30 '19 at 05:26
  • Can you add information about which steps you followed and the error log you're getting? – Happy-Monad Jan 03 '20 at 10:56