从自定义类导入时的XMLBeans JAR不能签署 [英] XMLBeans jar can't be signed when imported from custom class
问题描述
在NetBeans我创建的一些数据出口到使用Apache POI,它使用XMLBeans的一个EXCEL文件的导出类。
In NetBeans I created an Exporter class that exports some data to an EXCEL file using APACHE POI, which uses XMLBeans.
我通过下载的zip二进制文件和手动添加的罐子加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定义这个问题打开了一个错误。 <一href=\"https://issues.apache.org/jira/browse/XMLBEANS-499\">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并着手)(在这种情况下8)的.jar,这将删除重复的.class文件,然后使用jar工具来重新创建.jar文件。这个命令是:罐子CF(路径)\\ XMLBeans的-2.6.0.jar -C(解压缩文件夹路径)。不要忘记在命令的最后期限。然后,我复制了新的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屋!