建立出错合并jar文件 - 签署文件条目的javax /邮件/网络/ ContentDisposition.class没有manifiest节 [英] Error while creating consolidated jar file - no manifiest section for signature file entry javax/mail/internet/ContentDisposition.class

查看:850
本文介绍了建立出错合并jar文件 - 签署文件条目的javax /邮件/网络/ ContentDisposition.class没有manifiest节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些jar文件到/库/我的项目中的类位于/ target /中。要删除外部文件夹的依赖。我想打一个巩固的jar文件。其中包含jar文件中的所有发现的所有类/库/ *。JAR

我使用以下Ant脚本:

 <罐子destfile =mytest.jarBASEDIR =目标/班>
    <&舱单GT;
        <属性名=主类VALUE =com.mytest.MyProcessor/>
    < /清单>    <** / *类文件集DIR =目标/班包括= />
    < zipgroupfileset DIR =库包括=*罐子。/>
< /瓶>

但是,当我使用Java的罐子mytest.jar命令,它说运行jar:

异常线程mainjava.lang.SecurityException异常:签署文件条目的javax /邮件/网络/ ContentDisposition.class没有manifiest节
    在sun.security.util.SignatureFileVerifier.verifySection(来源不明)
    在sun.security.util.SignatureFileVerifier.processImpl(来源不明)

任何想法,如何做一个综合的jar 有没有这样的问题,将是非常美联社preciated。我使用的IntelliJ IDEA。


解决方案

  

异常线程mainjava.lang.SecurityException异常:签署文件条目没有manifiest栏目


此错误消息告诉正是为什么不建议在生产发行版捆绑的罐子。问题是你的一些依赖罐子与签名文件签名。重新包装可能违反的相关性JAR一些安全策略。

要使它工作,你需要从签名的jar删除所有签名文件,解压后的文件复制到您的最终版本的jar文件之前。需要注意的是< zipgroupfileset>不排除支持JAR档案中的文件,请尝试使用℃的名单; zipfileset>而不是:

 < zipfileset SRC =库/ mail.jar中>
  <排除NAME =** / * RSA,** / * SF,** / * DSA。/>
< / zipfileset>
......

I have some jar files into /libs/ and my project classes are located at /target/. To remove dependency on external folder. I want to make a consolidate jar file. Which contains all the classes from jar files found in all /libs/*.jar

I am using following Ant script:

<jar destfile="mytest.jar" basedir="target/classes">
    <manifest>
        <attribute name="Main-Class" value="com.mytest.MyProcessor"/>
    </manifest>

    <fileset dir="target/classes" includes="**/*.class"/>
    <zipgroupfileset dir="libs" includes="*.jar"/>
</jar>

But, when I run the jar using "java -jar mytest.jar" command, it says:

Exception in thread "main" java.lang.SecurityException: no manifiest section for signature file entry javax/mail/internet/ContentDisposition.class at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source) at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)

Any idea, how to make a consolidated jar that have no such issues, would be highly appreciated. I am using IntelliJ IDEA.

解决方案

Exception in thread "main" java.lang.SecurityException: no manifiest section for signature file entry

This error message tells exactly why bundled jar is not recommended for production release. The problem is some of your dependency jar is signed with signature files. repack it may violate some security policy on the dependency jar.

To make it work, you need remove all signature files from the signed jar, before copying the unpacked files into your final build jar file. Note that <zipgroupfileset> doesn't support exclude file within jar archive, try using a list of <zipfileset> instead:

<zipfileset src="libs/mail.jar">
  <exclude name="**/*.RSA, **/*.SF, **/*.DSA"/>
</zipfileset>
... ...

这篇关于建立出错合并jar文件 - 签署文件条目的javax /邮件/网络/ ContentDisposition.class没有manifiest节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆