NoSuchMethodError in main thread while reading xlsx using apache poi

前端 未结 3 2035
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 14:07

my code is

[...]
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.X         


        
3条回答
  •  遥遥无期
    2021-01-12 14:33

    Recent versions of poi-ooxml require you to use at least java 6. The method in question was only added since java 6. Consider upgrading your java version.

    From the official docs,

    The OOXML jars require a stax implementation, but now that Apache POI requires Java 6, that is provided by the JRE and no additional stax jars are required. The OOXML jars used to require DOM4J, but the code has now been changed to use JAXP and no additional dom4j jars are required.

    *Emphasis mine.

    Since the question was edited, I'm specifying the build this method was added:

    java 1.6.0_18

    So a minimum of this version must be used in OP's case.

提交回复
热议问题