Java 服務部署時改寫執行中的 JAR,讓尚未重啟的伺服器回報錯誤
We copied the new jar to every server before restarting any of them and the ones still waiting started throwing ZipException
重點導讀
Java 服務還在執行時,如果直接用新版本蓋掉舊 JAR,尚未重啟的伺服器可能會讀到對不上的內容,讓部分請求失敗。
- 作者把原本逐臺部署的流程改成先同時複製到十臺伺服器,結果還在使用舊 JAR 的 JVM 讀取新檔案時,出現 ZIP 格式錯誤和找不到類別的問題。
- 後來他們讓每個版本存成不同檔案,只在各臺伺服器重啟時切換連結,並在重啟後測試較少用到的功能。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
信源出處dev.to
We copied the new jar to every server before restarting any of them and the ones still waiting started throwing ZipException
本文為 888news 精選之重點導讀。若需閱讀作者完整原文、技術細節與官方討論,請前往原始網站。
來源: Dev.to Top Tech (dev.to)
開啟原文