POI - 无法在 osgi 中打开 xlsx 文件
POI - Can't open xslx files in osgi
尝试在 osgi 中读取 xlsx 文件时出现下一个异常 (jboss-fuse)。 Xls 工作正常。
使用捆绑包中的下一个 jar 文件:
<br>
lib/xml-apis-1.0.b2.jar, \<br>
lib/poi-scratchpad-3.9-20121203.jar, \<br>
lib/poi-3.9-20121203.jar, \<br>
lib/dom4j-1.6.1.jar, \<br>
lib/poi-ooxml-schemas-3.9-20121203.jar, \<br>
lib/poi-ooxml-3.9-20121203.jar, \<br>
lib/xmlbeans-2.3.0.jar, \<br>
lib/poi-excelant-3.9-20121203.jar, \<br>
lib/xmlbeans-xpath-2.3.0.jar <br>
117-org.apache.camel.camel-core - 2.12.0.redhat-610379 | ** org.apache.poi.openxml4j.exceptions.InvalidFormatException:
Can't read content types part !
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.(ContentTypeManager.java:107)
at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.(ZipContentTypeManager.java:56)
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:188)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:665)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:274)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:79)
因此,在捆绑包中的 META-INF/services 下添加下一个文件 "org.xml.sax.driver" 会有所帮助。
文件内容:
org.apache.xmlbeans.impl.piccolo.xml.Piccolo
将 poi 更新到最新版本 3.11 解决了没有该文件的问题:
lib/poi-scratchpad-3.11.jar, \
lib/poi-3.11.jar, \
lib/poi-ooxml-schemas-3.11.jar, \
lib/poi-ooxml-3.11.jar, \
lib/poi-excelant-3.11.jar, \
lib/xmlbeans-2.6.0.jar, \
lib/xmlbeans-xpath-2.6.0.jar
尝试在 osgi 中读取 xlsx 文件时出现下一个异常 (jboss-fuse)。 Xls 工作正常。
使用捆绑包中的下一个 jar 文件:
<br>
lib/xml-apis-1.0.b2.jar, \<br>
lib/poi-scratchpad-3.9-20121203.jar, \<br>
lib/poi-3.9-20121203.jar, \<br>
lib/dom4j-1.6.1.jar, \<br>
lib/poi-ooxml-schemas-3.9-20121203.jar, \<br>
lib/poi-ooxml-3.9-20121203.jar, \<br>
lib/xmlbeans-2.3.0.jar, \<br>
lib/poi-excelant-3.9-20121203.jar, \<br>
lib/xmlbeans-xpath-2.3.0.jar <br>
117-org.apache.camel.camel-core - 2.12.0.redhat-610379 | ** org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read content types part !
at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.(ContentTypeManager.java:107) at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.(ZipContentTypeManager.java:56) at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:188) at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:665) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:274) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:79)
因此,在捆绑包中的 META-INF/services 下添加下一个文件 "org.xml.sax.driver" 会有所帮助。 文件内容: org.apache.xmlbeans.impl.piccolo.xml.Piccolo
将 poi 更新到最新版本 3.11 解决了没有该文件的问题:
lib/poi-scratchpad-3.11.jar, \
lib/poi-3.11.jar, \
lib/poi-ooxml-schemas-3.11.jar, \
lib/poi-ooxml-3.11.jar, \
lib/poi-excelant-3.11.jar, \
lib/xmlbeans-2.6.0.jar, \
lib/xmlbeans-xpath-2.6.0.jar