How do I get Apache POI and JAXB to work together?

一个人想着一个人 提交于 2019-12-02 07:57:16

问题


java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject

I get that error when I run my code. Ok, that's fine - I just forgot to get XMLBeans... but it's been retired and I can't find a recent version in their archives. So I found that JAXB can be an alternative, I downloaded it and tried adding the jar files to my library in Intellij, but I still get the same error looking for the XMLBeans dependency.

How do I get Apache POI to use JAXB in place of XMLBeans? Why does JAXB have like 7 different jar files and I can't find out what any of them do? I just want to work on some excel files and not go on a wild goose chase :(


回答1:


XMLBeans is a dependency of Apache POI and POI won't use a different library in it's place. XMLBeans comes packaged in the Apache POI downloads which I have checked, so you should have it available to you. You just need to ensure the xmlbeans jar file is in the java classpath when running your application.

I have checked the latest POI binary tar.gz file 'poi-bin-3.14.tar.gz' available from http://poi.apache.org/download.html#POI-3.14, extracting the compressed tar archive (I use 7-Zip), you will find xmlbeans-2.6.0.jar in the poi-3.14/ooxml-lib directory.



来源:https://stackoverflow.com/questions/38042811/how-do-i-get-apache-poi-and-jaxb-to-work-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!