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,它可為您提供更多網路應用程式開發功能,並且已和 App Engine 部署程序更緊密地整合。
App Engine Cloud Endpoints v1.0 是否可以在 Java 8 執行階段中運作?
不可以。您必須遷移至 Cloud Endpoints Frameworks 2.0 版。
為什麼我會在重新封裝的類別收到 java.lang.NoClassDefFoundError?
Java 8 執行階段中已不再提供重新封裝的內部類別 (例如 com/google/appengine/repackaged/com/google/common/collect/ImmutableList
),即使在舊版 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
Metadata Server 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
為什麼我的要求無法回應?
如果您是針對要求而建立執行緒集區,則必須確保在目前的要求終止之前將其明確關閉。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間: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"]],["上次更新時間: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."]]