Java SecurityException no manifiest section for signature file

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 07:49:18

问题


When I'm running a executable .jar file created with maven build, I'm getting the below error:


Exception in thread "main" java.lang.SecurityException: no manifiest section 
for signature file entry 
org/bouncycastle/cms/CMSSignedDataStreamGenerator$TeeOutputStream.class
    at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)
    at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
    at sun.security.util.SignatureFileVerifier.process(Unknown Source)
    at java.util.jar.JarVerifier.processEntry(Unknown Source)
    at java.util.jar.JarVerifier.update(Unknown Source)
    at java.util.jar.JarFile.initializeVerifier(Unknown Source)
    at java.util.jar.JarFile.getInputStream(Unknown Source)
    at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
    at sun.misc.Resource.cachedInputStream(Unknown Source)

Points can be noted: I'm building a Java swing project with Maven 3.3. I'm targeting a maven shaded jar file, and when running the jar file with 'java -jar ' I'm getting the above error.

Any help is appreciated. Please let me know if anyone need any more information. I am stuck; please help.


回答1:


I have excluded the licence files from maven as suggested by @MadProgrammer. Used below codes in pom.xml

<filters>
<filter>    
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.INF</exclude> <!-- This one may not be required -->
</excludes>
</filter>
</filters>


来源:https://stackoverflow.com/questions/48755420/java-securityexception-no-manifiest-section-for-signature-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!