使用poi读取excel时出现两个错误,记录一下:
java.lang.ClassNotFoundException:org.apache.xmlbeans.XmlObject
org.apache.commons.collections4.ListValuedMap
1、报错内容:java.lang.ClassNotFoundException:org.apache.xmlbeans.XmlObject
缺少相关的jar包:
pom中加入:
org.apache.xmlbeans xmlbeans 2.4.0
更新maven即可。
2、报错内容:org.apache.commons.collections4.ListValuedMap
导入以下jar包
由于我的poi是3.17的,
org.apache.commons commons-collections4 4.1
3、The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
主要原因是xssf只能读取.xslx的excel
hssf只能读取.xsl的excel
查看一下文件的后缀是否正确



