Apache的POI例外阅读XLSX文件 [英] apache POI exception in reading xlsx files
本文介绍了Apache的POI例外阅读XLSX文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Apache POI读 XLSX 文件中加入下面的依赖
I'm using apache POI for reading xlsx files by adding below dependencies
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.5.0</version>
</dependency>
我越来越有码头插件运行,即使部署在tomcat的同时,以下情况例外。
I'm getting following exception while running with jetty plugin even if deployed in tomcat.
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
......
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
...........
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument
at org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument$Factory.parse(Unknown Source)
at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:121)
at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:92)
... 186 more
我删除XMLBeans的依赖,因为Maven会自动自动下载POI的依赖,还是一样exception.Any帮助?
I removed the xmlbeans dependency because the maven will automatically download poi dependencies automatically, still the same exception.Any help?
推荐答案
我用POI与3.12版本。还需要以下依赖性:
I used poi with version 3.12. The following dependency is also required:
编译org.apache.poi:OOXML-模式:1.1
又见 http://poi.apache.org/faq.html#faq-N10025
这篇关于Apache的POI例外阅读XLSX文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文