Java源代码构建的“Manifest主要属性的签名文件摘要无效”

时间:2013-06-03 18:31:07

标签: java security jar manifest

我在Linux(SLES 11)上使用Oracle源代码构建java。到目前为止,我已经解决了这些问题,但是遇到了正在处理rt.jar文件的问题。

显示的最后一个命令是

打包/build/linux-amd64/j2re-image/lib/rt.jar 61228544 bytes

后跟异常和堆栈跟踪:

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

我不熟悉jar文件的签名,我不确定为什么构建会首先执行此操作。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:3)

尝试从jar中删除META-INF文件夹,添加清单并再次签署JAR,它帮助了我:http://jehy.ru/articles/2013/12/13/invalid-signature-file-digest-for-manifest-main-attributes/