从源代码构建 Java 上的“清单主要属性的签名文件摘要无效”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16903430/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Invalid signature file digest for Manifest main attributes" on Java build from source
提问by Jman
I am building java from the Oracle source code, on Linux (SLES 11). I have gotten through the glitches up to this point, but have hit a problem where the rt.jar file is being processed.
我正在 Linux (SLES 11) 上从 Oracle 源代码构建 java。到目前为止,我已经解决了故障,但在处理 rt.jar 文件时遇到了问题。
The last command shown is
显示的最后一个命令是
Packing /build/linux-amd64/j2re-image/lib/rt.jar 61228544 bytes
打包/build/linux-amd64/j2re-image/lib/rt.jar 61228544 字节
followed by the exception and stack trace:
其次是异常和堆栈跟踪:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.java.util.jar.pack.TLGlobals.<init>(TLGlobals.java:67)
at com.sun.java.util.jar.pack.PackerImpl.<init>(PackerImpl.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at java.util.jar.Pack200.newInstance(Pack200.java:748)
at java.util.jar.Pack200.newPacker(Pack200.java:134)
at com.sun.java.util.jar.pack.Driver.main(Driver.java:266)
Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:240)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:262)
at java.util.jar.JarVerifier.update(JarVerifier.java:216)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:345)
at java.util.jar.JarFile.getInputStream(JarFile.java:412)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:162)
at java.net.URL.openStream(URL.java:1037)
at java.lang.ClassLoader.getSystemResourceAsStream(ClassLoader.java:1364)
at java.lang.Class.getResourceAsStream(Class.java:2086)
at com.sun.java.util.jar.pack.PropMap.<clinit>(PropMap.java:127)
... 10 more
I am not familiar with signing jar files, and I'm not sure why the build is doing this in the first place. Any help would be appreciated.
我不熟悉签署 jar 文件,我不确定为什么构建首先要这样做。任何帮助,将不胜感激。
回答by Jehy
Try removing META-INF folder from jar, adding manifest and signing JAR again, it helped me: http://jehy.ru/articles/2013/12/13/invalid-signature-file-digest-for-manifest-main-attributes/
尝试从 jar 中删除 META-INF 文件夹,再次添加清单并签署 JAR,这对我有帮助:http: //jehy.ru/articles/2013/12/13/invalid-signature-file-digest-for-manifest-main-属性/