GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot deploy java11 application due to paradoxical error messages

gregorbg opened this issue · comments

I have set up the Gradle plugin and SDK as described, and everything seems to be working fine.

My appengine-web.xml looks as follows:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <threadsafe>true</threadsafe>
    <runtime>java11</runtime>
</appengine-web-app>

Upon executing ./gradlew appengineDeploy, the plugin complains with the following error message:

> Task :webscrambles:appengineDeploy FAILED
ERROR: (gcloud.app.deploy) The [threadsafe] field is specified in file [/path/to/project/build/staged-app/app.yaml]. This field is not supported with runtime [java11] and can safely be removed.

By duly following the directions expressed in this error message, I changed my appengine-web.xml to be:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <runtime>java11</runtime>
</appengine-web-app>

But then the following error message appears upon executing the same ./gradlew appengineDeploy command:

Bad configuration: appengine-web.xml does not contain a <threadsafe> element.
See http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests for more information.
You probably want to enable concurrent requests.

This prompts me to add back the <threadsafe> tag, which would only trigger the other error message about the property being redundant in java11.

I have fixed the issue for now by deploying to java8, but I definitely want to switch to java11 in the long run. Please fix this loophole :)

commented

Java11 is not an allowed runtime when using appengine-web.xml based applications. If you want to build an application that uses java11 you must explicitly use an app.yaml based application.

https://cloud.google.com/appengine/docs/standard/java11/runtime

@saturnism or @ludoch maybe can provide more information here.

I think the plugin can maybe fail earlier though.

Right, for Java11, follow the documentation around
https://cloud.google.com/appengine/docs/standard/java11/

and a migration guide at
https://bugs.openjdk.java.net/browse/JDK-8229421
In general, Java11 runtime is different than Java8, you are in charge of providing the web framework (War support is optional and user controlled).
See man samples at:
https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine-java11

Appu, yes, we should provide better error reporting at the plugin/core if this becomes a trouble...