Read Excel using Apache POI - Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException:
Read Excel using Apache POI - Challenges
------------------------------------------------
1) E
xception
in thread "main"
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied
data appears to be in the Office 2007+ XML. You are calling the part
of POI that deals with OLE2 Office Documents. You need to call a
different part of POI to process this data (eg XSSF instead of HSSF)
-- Use poi-ooxml from xlsx files while poi for xls
<!-- POI : Excel library -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<
groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency
2)Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
-- Reading excel using apache POI – Add library
xmlbeans-x.x.x.jar
from maven
3) Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap
-- add library from common collections (from maven)
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
Comments
Post a Comment