简体   繁体   English

如何重新打包Java Web Archive(WAR)?

[英]How to repack an Java Web Archive (WAR)?

I have a .war file of an application. 我有一个应用程序的.war文件。 It works, but I need to update some inner jars (only minor version changes) 它可以工作,但是我需要更新一些内部jar (仅对次要版本进行更改)

While I can operate on .war archives using the midnight commander, the files can't be executed anymore: java.lang.SecurityException: SHA1 digest error . 虽然我可以使用午夜指挥官对.war档案进行操作,但无法再执行以下文件: java.lang.SecurityException: SHA1 digest error

I tried repacking it using the jar command, but I get it wrong: The archive contains new META-INF, and no WEB-INF (which is needed). 我尝试使用jar命令重新打包它,但我弄错了:归档文件包含新的META-INF,而没有WEB-INF(需要)。

Thank you for proposed solutions! 感谢您提出的解决方案!

The names should be META-INF and WEB-INF , without an "O". 名称应为META-INFWEB-INF ,不带“ O”。

Are you modifying the jar files in WEB-INF/libs ? 您是否正在修改WEB-INF/libs的jar文件? Because it sounds like you have tampered with a signed archive, and normally the war itself is unsigned. 因为听起来您已经篡改了已签名的存档,并且通常战争本身是未签名的。

If you alter a signed jar file, the signature is invalidated. 如果更改签名的jar文件,则签名无效。 Either re-sign the code with your code-signing key, or remove the invalidated signature information from the META-INF. 请使用您的代码签名密钥对代码重新签名,或从META-INF中删除无效的签名信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM