0

I have an application runing in App engine Standar Environment done in java and accessing to the datastore with datanucleus. It is working fine and, as it is running inside the Standard Environment, it connects to datastore perfecly.

Now, I am deploying a new service for the application done in Spring Boot with the spring-cloud-gcp-data-datastore library. I have the .json file for the connection for the service account and it is working perfectly on my local environment with the gcloud beta emulator.

But now, in the production environment, when the app try to connect to the datastore, I can see the error in the logs:

com.google.cloud.datastore.DatastoreException: I/O error ... Caused by: com.google.datastore.v1.client.DatastoreException: I/O error ... Caused by: java.net.ConnectException: Connection refused (Connection refused)

Seems that the service can't connect to the datastore.

How can I see what is wrong in the connection? Is there anyway to list the connection process for the Spring boot application and datastore?

Resolved

Thanks to Mike for all his support. He gave me the key with the Spring Cloud GCP documentation.

The problem was that I must disable the configuration for the local emulator when I deploy to Production. If you don't do that, the application doesn't find the Datastore service.

Once I commented the line for the spring.cloud.gcp.datastore.host configuration (Datastore Emulator Autoconfiguration), the application worked fine in production.

  • Are you using App Engine 8 or 11? I believe AE 8 cannot connect to the standalone Datastore, but I might be wrong on that. Also, are you able to connect to the actual Datastore (not emulator) from local? – Mike E. Sep 09 '21 at 01:31
  • I am deploying a project with java 11 to my app engine standard environment as a service. I supose it is running in separate environment than my older application because it is 8. That I could see is that, in local, from the old one I can connect to the actual Datastore but not to the Emulator. And for the new one, I can connect to the emulator but not to the actual Datastore (running inside the project). – Jorge Merino Llamera Sep 09 '21 at 15:26
  • In you `app.yaml`, do you have `runtime: java11`? – Mike E. Sep 09 '21 at 20:54
  • yes, but the other app that is running in app engine standard environment is in java8. It connects to the datastore using datanucleus. – Jorge Merino Llamera Sep 09 '21 at 21:46
  • App Engine Java 8 and 11 are very different. The way you connect to Datastore is also different. See: https://cloud.google.com/appengine/docs/standard/java11/java-differences. For AE 11, use the Datastore API (https://cloud.google.com/datastore/docs/reference/libraries), or the Spring Cloud GCP support (https://googlecloudplatform.github.io/spring-cloud-gcp/2.0.4/reference/html/index.html#spring-data-cloud-datastore) which has ORM support. – Mike E. Sep 10 '21 at 17:56

0 Answers0