从自定义类导入时无法对 XMLBeans jar 进行签名 [英] XMLBeans jar can't be signed when imported from custom class

查看:34
本文介绍了从自定义类导入时无法对 XMLBeans jar 进行签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 NetBeans 中,我创建了一个 Exporter 类,该类使用使用 XMLBeans 的 APACHE POI 将一些数据导出到 EXCEL 文件.

In NetBeans I created an Exporter class that exports some data to an EXCEL file using APACHE POI, which uses XMLBeans.

我通过下载 zip 二进制文件并手动添加 jar 来添加 APACHE POI 3.10.1 库.

I added the APACHE POI 3.10.1 libraries by downloading the zip binaries and adding the jars manually.

当我在同一个项目中使用这个类时,一切运行正常.

When I use this class inside the same project, everything runs correctly.

然后我将这个类添加到另一个项目中,方法是右键单击库 -> 添加项目.

Then I added this class to another project, via right click Libraries -> Add Project.

但是当我尝试运行它时,编译时出现以下错误.

But when I tried running this I got the following error while compiling.

Signing JAR: C:\Users\c\p\dist\lib\xmlbeans-2.6.0.jar to C:\Users\c\p\dist\lib\xmlbeans-2.6.0.jar as nb-jfx
jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry:    org/apache/xmlbeans/xml/stream/Location.class
Enter Passphrase for keystore: Enter key password for nb-jfx: 
C:\Users\c\p\nbproject\jfx-impl.xml:1465: The    following error occurred while executing this line:
C:\Users\c\p\nbproject\jfx-impl.xml:2968: The following error occurred while executing this line:
C:\Users\c\p\nbproject\jfx-impl.xml:1940: jarsigner   returned: 1

我不知道这可能是关于什么,但让我发疯.

I don't know what this might be about, but is driving me crazy.

推荐答案

XMLBEANS Jira 中存在一个定义此问题的错误.https://issues.apache.org/jira/browse/XMLBEANS-499 和评论之一报告修复.我还没有尝试过,但正在这样做.看看吧.

There's a bug opened in XMLBEANS Jira that defines this issue. https://issues.apache.org/jira/browse/XMLBEANS-499 and one of the comments reports a fix. I've not tried it yet but am in the process of doing so. Check it out.

更新:已解决.事后看来,如果 .jar 已正确创建,解决方案是显而易见的,但却是不必要的.解压缩(我只是将 .jar 扩展名更改为 .zip 并继续).jar 将删除重复的 .class 文件(在本例中为 8),然后使用 jar 工具重新创建 .jar 文件.命令为:jar cf (path)\xmlbeans-2.6.0.jar -C (unzipped folder path)".不要忘记命令末尾的句点.然后我将新的 xmlbeans-2.6.0.jar 复制到我的 lib 目录中,现在一切正常.希望这对其他人有帮助!:-)

Updated: Resolved. In hindsight the resolution is obvious but painfully unnecessary if the .jar had been properly created. Unzip (I simply changed the .jar extension to .zip and proceeded) the .jar which will remove the duplicate .class files (8 in this case) then use the jar tool to recreate the .jar file. The command is: "jar cf (path)\xmlbeans-2.6.0.jar -C (unzipped folder path) ." Don't forget the period at the end of the command. Then I copied the new xmlbeans-2.6.0.jar into my lib directory and all is now well. Hope this helps someone else! :-)

这篇关于从自定义类导入时无法对 XMLBeans jar 进行签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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