Java 8 已达到支持终止期限,并将于 2026 年 1 月 31 日
弃用。弃用后,您将无法部署 Java 8 应用,即使您的组织之前曾使用组织政策重新启用旧版运行时的部署,也无法部署。现有的 Java 8 应用在
弃用日期之后将继续运行并接收流量。我们建议您
迁移到最新支持的 Java 版本。
App Engine Java 8 运行时常见问题解答
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以下问题适用于 App Engine Java 8 标准运行时。
我可以将 Kotlin 与 Java 8 运行时搭配使用吗?
可以,请查看我们 GitHub 代码库中的 Kotlin 示例。
可以,使用内置的 Maven 集成。
您还可以使用 IntelliJ Ultimate Edition,它为您提供更多 Web 应用开发功能,同时与 App Engine 部署过程的集成更为紧密。
App Engine Cloud Endpoints v1.0 是否能在 Java 8 运行时中工作?
不能。您必须迁移到 Cloud Endpoints Frameworks 2.0 版。
为什么我会收到关于重新打包类的 java.lang.NoClassDefFoundError?
重新打包的内部类(如 com/google/appengine/repackaged/com/google/common/collect/ImmutableList
)在 Java 8 运行时中不再可用,即使它们在旧版 App Engine API JAR 中已定义也是如此。
如果您需要在 Java 8 应用中使用重新包装的类,请在 appengine-web.xml
中将 appengine.api.legacy.repackaging
设置为 true。例如:
<system-properties>
<property name="appengine.api.legacy.repackaging" value="true">
</system-properties>
我们建议您使用非重新打包的公共类替换这些类。
我可以在 Java 8 和 Java 11 之间进行流量拆分吗?
可以,每个服务或模块版本都可以使用不同的运行时版本,并且支持流量拆分。
当实例没有接到请求时,如何处理 Java 8 线程?
使用 App Engine API 创建的线程会继续像以前一样工作。
自动扩缩 |
手动扩缩 |
基本扩缩 |
实例因缺少请求而终止。 |
最后一个请求后实例终止(默认值:5 分钟) |
永远运行。 |
App Engine Java 8 运行时支持以下元数据服务器网址:
/computeMetadata/v1/project/numeric-project-id (pending)
/computeMetadata/v1/project/project-id
/computeMetadata/v1/instance/zone
/computeMetadata/v1/instance/service-accounts/default/aliases
/computeMetadata/v1/instance/service-accounts/default/email
/computeMetadata/v1/instance/service-accounts/default/scopes
/computeMetadata/v1/instance/service-accounts/default/token
/computeMetadata/v1/instance/service-accounts/{account}/aliases
/computeMetadata/v1/instance/service-accounts/{account}/email
/computeMetadata/v1/instance/service-accounts/{account}/scopes
/computeMetadata/v1/instance/service-accounts/{account}/token
元数据服务器 v1beta1
v1beta1 元数据服务器已弃用,并计划关停。请务必更新所有使用 v1 或更高版本的请求。如需了解详情,请参阅转换到 v1 元数据服务器端点。
/computeMetadata/v1beta1/project/numeric-project-id (pending)
/computeMetadata/v1beta1/project/project-id
/computeMetadata/v1beta1/instance/zone
/computeMetadata/v1beta1/instance/service-accounts/default/aliases
/computeMetadata/v1beta1/instance/service-accounts/default/email
/computeMetadata/v1beta1/instance/service-accounts/default/scopes
/computeMetadata/v1beta1/instance/service-accounts/default/token
/computeMetadata/v1beta1/instance/service-accounts/{account}/aliases
/computeMetadata/v1beta1/instance/service-accounts/{account}/email
/computeMetadata/v1beta1/instance/service-accounts/{account}/scopes
/computeMetadata/v1beta1/instance/service-accounts/{account}/token
为什么我的请求没有收到响应?
如果您针对请求创建线程池,则必须确保在当前请求终结之前明确地关闭线程池。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-04。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eKotlin is supported within the Java 8 runtime, and examples can be found in the provided GitHub repository.\u003c/p\u003e\n"],["\u003cp\u003eIntelliJ IDEA, both Community and Ultimate Editions, can be used with App Engine, with Ultimate Edition offering more advanced integration.\u003c/p\u003e\n"],["\u003cp\u003eCloud Endpoints v1.0 is not compatible with the Java 8 runtime; migration to Cloud Endpoints Frameworks version 2.0 is required.\u003c/p\u003e\n"],["\u003cp\u003eRepackaged classes are not available in Java 8 runtime unless \u003ccode\u003eappengine.api.legacy.repackaging\u003c/code\u003e is set to true in \u003ccode\u003eappengine-web.xml\u003c/code\u003e, but using public classes is the recommended approach.\u003c/p\u003e\n"],["\u003cp\u003eTraffic splitting is supported between different runtime versions, like Java 8 and Java 11, allowing each service or module version to utilize a different runtime.\u003c/p\u003e\n"]]],[],null,["# App Engine Java 8 Runtime FAQ\n\nThe following questions apply to the App Engine Java 8 standard runtime.\n\nCan I use Kotlin with the Java 8 runtime?\n-----------------------------------------\n\nYes, check out our [Kotlin samples](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8) in the GitHub repository.\n\nCan I use IntelliJ IDEA Community Edition with App Engine?\n----------------------------------------------------------\n\nYes, using the built-in [Maven integration](/appengine/docs/legacy/standard/java/using-maven).\n\nYou can also use IntelliJ Ultimate Edition, which provides you with more web\napplication development features and has tighter integration with the\nApp Engine deployment process.\n\nDoes App Engine Cloud Endpoints v1.0 work in the Java 8 runtime?\n----------------------------------------------------------------\n\nNo. You must\n[migrate to Cloud Endpoints Frameworks version 2.0](/endpoints/docs/frameworks/legacy/v1/java/migrating).\n\nWhy do I get java.lang.NoClassDefFoundError for repackaged classes?\n-------------------------------------------------------------------\n\nRepackaged internal classes, such as\n`com/google/appengine/repackaged/com/google/common/collect/ImmutableList`,\nare not available anymore in the Java 8 runtime, even if they are defined in\nprevious versions of the App Engine API JAR.\n\nIf you need to use the repackaged classes in your Java 8 app, set\n`appengine.api.legacy.repackaging` to true in the `appengine-web.xml`. For\nexample: \n\n \u003csystem-properties\u003e\n \u003cproperty name=\"appengine.api.legacy.repackaging\" value=\"true\"\u003e\n \u003c/system-properties\u003e\n\nWe recommend that you replace these classes with the public, non-repackaged\nclasses.\n\nCan I do traffic splitting between Java 8 and Java 11?\n------------------------------------------------------\n\nYes, each service or module version can use a different runtime version, and\ntraffic splitting is supported.\n\nHow are Java 8 threads treated when an instance isn't getting requests?\n-----------------------------------------------------------------------\n\nThreads created with App Engine APIs will continue to work as before.\n\nWhat Metadata server features are supported in the App Engine Java 8 runtime?\n-----------------------------------------------------------------------------\n\nThe App Engine Java 8 runtime supports the following\n[Metadata server](/compute/docs/storing-retrieving-metadata) urls: \n\n /computeMetadata/v1/project/numeric-project-id (pending)\n /computeMetadata/v1/project/project-id\n /computeMetadata/v1/instance/zone\n /computeMetadata/v1/instance/service-accounts/default/aliases\n /computeMetadata/v1/instance/service-accounts/default/email\n /computeMetadata/v1/instance/service-accounts/default/scopes\n /computeMetadata/v1/instance/service-accounts/default/token\n /computeMetadata/v1/instance/service-accounts/{account}/aliases\n /computeMetadata/v1/instance/service-accounts/{account}/email\n /computeMetadata/v1/instance/service-accounts/{account}/scopes\n /computeMetadata/v1/instance/service-accounts/{account}/token\n\n**Metadata Server v1beta1**\n\nThe v1beta1 Metadata server is deprecated and scheduled for shutdown. Ensure\nthat you update all requests to use v1 or newer. For more information, see\n[Transitioning to the v1 metadata server endpoint](/compute/docs/storing-retrieving-metadata#transitioning). \n\n /computeMetadata/v1beta1/project/numeric-project-id (pending)\n /computeMetadata/v1beta1/project/project-id\n /computeMetadata/v1beta1/instance/zone\n /computeMetadata/v1beta1/instance/service-accounts/default/aliases\n /computeMetadata/v1beta1/instance/service-accounts/default/email\n /computeMetadata/v1beta1/instance/service-accounts/default/scopes\n /computeMetadata/v1beta1/instance/service-accounts/default/token\n /computeMetadata/v1beta1/instance/service-accounts/{account}/aliases\n /computeMetadata/v1beta1/instance/service-accounts/{account}/email\n /computeMetadata/v1beta1/instance/service-accounts/{account}/scopes\n /computeMetadata/v1beta1/instance/service-accounts/{account}/token\n\nWhy do my requests fail to respond?\n-----------------------------------\n\nIf you create a thread pool on a request, you must make sure that you explicitly\nshut it down before the current request terminates."]]