问题
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