Google Cloud App Engine 在导航到 link 时出现 404 错误

Google Cloud App Engine gives 404 error when navigating to the link

我是 App Engine 的新手,所以这可能很简单。

我正在尝试将 hello world Spring 应用程序上传到 App Engine Flexible。 Spring 应用程序有 1 个端点(“/”),其中 returns 字符串“Hello world”。我在 Intellij 中使用了 Google App Engine 插件来上传我的应用程序,上传似乎很顺利,我可以在 App Engine 仪表板中看到它。当我通过访问 localhost:8080 在本地测试应用程序时,文本“Hello world”按预期显示。

我遇到的问题是,当我在 App Engine 仪表板中单击版本时,它会将我带到 404 错误屏幕(见下文)而不是显示“Hello world”。

"404. That's an error. The requested URL was not found on this server. That's all we know.

我还注意到,当我上传应用程序时,流量分配设置为 0%,当我尝试在最新版本上将流量分配更改为 100% 时,我收到另一个错误消息,显示“流量拆分无法保存设置。"

我的 app.yaml 文件如下所示:

runtime: java
env: flex
service: spring-service

runtime_config: # Optional
  jdk: openjdk8

handlers:
  - url: /.*
    script: this field is required, but ignored

manual_scaling:
  instances: 1

如有任何帮助,我们将不胜感激。

从您的 app.yaml 中删除此行:

service: spring-service

这应该可以解决问题。您可能需要阅读文档以了解 GAE 中的 service 是什么。