将 xml beans jar 重新打包到我自己的 jar 中时,xmlbeans 无法找到架构资源
我正在编写一个需要包含在 jar 中的应用程序。
该程序需要验证并从 Excel 电子表格中获取数据。因此,我使用依赖于 xmlbeans jar 的 Apache POI 库。
我的问题是,当我使用 ant Build 将 xmlbeans jar 包含在我的 jar 中
<jar
...
<zipfileset src="${xmlbeans.jar}" includes="**/*" />
然后运行该 jar 时,我收到以下错误:
Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb (schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.index) - code 0
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(SchemaTypeSystemImpl.java:1519)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:273)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:185)
当使用 testng 进行单元测试时,效果很好。所以问题显然在于将 xmlbeans jar 合并到我的 jar 中。可以这样做吗? POI 库依赖于它。
我已经解压了我的jar,确实资源丢失了。
我正在为我正在使用的 poi 库使用正确版本的 xmlbeans。
这是我正在使用的库:
poi-3.7.jar poi-ooxml-3.7-beta3.jar poi-ooxml-schemas-3.7-beta3.jar
和以下版本的 xmlbeans:
xmlbeans-2.3.0.jar
非常感谢
I am writing an application that needs to be contained in a jar.
The program needs to validate and grab data from an excel spreadsheet. Therefore I am using the Apache POI libraries which are dependent on xmlbeans jar.
My problem is that when I include the xmlbeans jar in my jar using ant
<jar
...
<zipfileset src="${xmlbeans.jar}" includes="**/*" />
Build and then run the jar, I get the following error:
Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb (schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.index) - code 0
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(SchemaTypeSystemImpl.java:1519)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:273)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:185)
When unit testing with testng this works fine. So the problem obviously lies with incorporating the xmlbeans jar into my jar. Is it possible to do this? POI libraries are dependent on it.
I have uncompressed my jar, and indeed the resource is missing.
I am using the correct version of xmlbeans for the poi libraries I am using.
Here are the libraries I am using:
poi-3.7.jar
poi-ooxml-3.7-beta3.jar
poi-ooxml-schemas-3.7-beta3.jar
and the following version of xmlbeans:
xmlbeans-2.3.0.jar
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论