Hello,
Migrating my GAE service from Java 8 to Java 11, I'm using App Engine bundled service.
API document shows there are datastore APIs,
https://cloud.google.com/appengine/docs/standard/java11/reference/services/bundled
But when I deploy my service on Java 11 runtime, I got $FeatureNotEnabledException
javax.servlet.ServletException: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: datastore_v3.RunQuery
There's a blog post saying it's back,
But I'm not sure I can use "com.google.appengine.api.datastore.Query" like this
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Key key = KeyFactory.createKey("Memobook", user.getEmail()); Query query = new Query("Memo", key); datastore.prepare(query);
If your question is to know how to use "com.google.appengine.api.datastore.Query". Google public documentation[1] recommends instead of using App Engine APIs or Google Cloud APIs, you can use Objectify to access Datastore. Objectify[2] is an open-source API for Cloud Datastore that provides a higher-level of abstraction than App Engine APIs and Google Cloud APIs.
[1] https://cloud.google.com/appengine/docs/standard/java/datastore#using_objectify_with
Thanks for your reply.
I'm wondering about App Engine API in general, cause com.google.appengine.api.users.User in my jsp makes the same exception. 😞
If you're trying to access any of the bundled services in Java 11, you must enable them -- they aren't turned on by default like they are with Java 8. Please follow the instructions at cloud.google.com/appengine/docs/standard/java11/services/access , especially use of the appengine-web.xml file.
Thank you for the replay, wescpy. This is first few lines of my appengine-web.xml, and it's already enabled as I know
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<runtime>java11</runtime>
<app-engine-apis>true</app-engine-apis>
FYI, "mvn clean package appengine:run" runs fine locally, but "mvn appengine:deploy" makes this exception on App Engine.
And my eclipse says XML error, but I'm not sure it's OK.
cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://appengine.google.com/ns/1.0":app-engine-apis}'. One of '{"http://appengine.google.com/ns/1.0":application, ... "http://appengine.google.com/ns/1.0":vpc-access-connector}' is expected. appengine-web.xml /memobook/war/WEB-INF line 4 XML Problem
Did you get this resolved? I have exactly the same problem. I'm even using Objectify v5.1.5.
As you said it all works fine locally using "mvn clean package appengine:run", but once deployed I get the error when running on GCP:
javax.servlet.ServletException: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: datastore_v3.RunQuery
Thanks
Tim
I had upgraded all my dependencies to the latest including appengine-api-1.0-sdk, but still got this error even after following all the instructions and adding the correct info to my my appengine-web.xml
I then noticed my gcloud was running an old 350.0.0. So upgraded that to 429.0.0 and re-deployed and it worked.
Hi, can you please, share details on how did you solve this.
I am getting exactly this message when accessing datastore with objectify after deploying to google cloud:
javax.servlet.ServletException: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: datastore_v3.RunQuery
cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://appengine.google.com/ns/1.0":app-engine-apis}'
Hi rodteixo - I am running into the same problem you when <app-engine-apis>true</app-engine-apis> is added to appengine-web..xml, this prevents GAE project from building with Gradle.
I have all the latest Google SDK / CLI installations and most recent GAE dependencies running on Android Studio Giraffe.
Did you every figure out how to enable this line and access the legacy bundled services?
Thanks - bk
TLDR: Upgrade your gcloud CLI/SDK to the latest version or any version released from last quarter of 2022 and upwards
Explanation:
Bundled APIs for newer runtimes were first released in 'beta' which meant that deploying them required using 'gcloud beta app deploy' and not 'gcloud app deploy'.
The Bundled APIs later became GA (either 2nd or 3rd quarter of 2022) and so you could then deploy using 'gcloud app deploy'.