gpt4 book ai didi

JavaFX 12 - list 主要属性的签名文件摘要无效

转载 作者:太空宇宙 更新时间:2023-11-04 09:28:01 25 4
gpt4 key购买 nike

我正在开发 JavaFX 12 的示例,但是当生成要执行的 JAR 文件时,我收到此错误:

java -jar target/JRPrintPreview-1.0-SNAPSHOT.jar 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at java.base/sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:336)
at java.base/sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:269)
at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:316)
at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:230)
at java.base/java.util.jar.JarFile.initializeVerifier(JarFile.java:758)
at java.base/java.util.jar.JarFile.ensureInitialization(JarFile.java:1035)
at java.base/java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:69)
at java.base/jdk.internal.loader.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:870)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:788)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:415)
at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:760)
at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:655)

我的样本在这里: https://github.com/prsolucoes/jrprintpreview

您可以在终端中使用命令进行测试:

mvn clean  
mvn compile
mvn package
java -jar target/JRPrintPreview-1.0-SNAPSHOT.jar

我输入了一个命令来对 jar 进行签名:

mvn jarsigner:sign

但不要产生任何效果(有必要吗?)。

我搜索了很多并尝试了删除所有 MANIFEST RSA 和其他签名文件等。

有人可以帮助我吗?

谢谢。

最佳答案

我可以从您的 pom.xml 中看到您正在使用 Maven Shade 插件来生成 JAR。这基本上会将所有依赖项捆绑到一个( super )JAR 文件中。 super 请看一下以下答案,它可能会解决您的问题: For those who got this error when trying to create an uber-jar with maven-shade-plugin [...]

另请参阅以下内容 comment同一答案解释了问题可能是什么:

The signature files are there to indicate that the contents of this jar have these files. When you make an uber jar, you're adding a bunch more files to the jar, and thus the signature is not correct. If you really wanted, you could re-sign the new jar, but of course it would be with your signature, not the old one. Alternatively, you could not distribute the uber jar, but instead include the signed jar as a separate file, but then that defeats the purpose of an uber jar in the first place. – LadyCailin Jan 22 at 12:45

关于JavaFX 12 - list 主要属性的签名文件摘要无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57446735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com