问题描述
当我运行使用maven build创建的可执行.jar文件时,我收到以下错误:
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)
可以注意到点:我正在使用Maven 3.3构建Java swing项目。我的目标是maven阴影jar文件,当使用'java -jar'运行jar文件时,我收到了上述错误。
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.
推荐答案
我已根据@MadProgrammer的建议从maven中排除了许可文件。
在pom.xml中使用以下代码
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>
这篇关于Java SecurityException没有签名文件的最明显部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!