alibaba / easyexcel

快速、简洁、解决大文件内存溢出的java处理Excel工具
https://easyexcel.opensource.alibaba.com
Apache License 2.0
31.53k stars 7.45k forks source link

最新版本3.1.0+poi 5.2.2 导入数据读取备注时报NoSuchMethodError异常 #2786

Open ouyang993670 opened 1 year ago

ouyang993670 commented 1 year ago

触发场景描述 将xlsx07版本得Excel导入时。读取头部备注信息 触发Bug的代码 EasyExcel.read(PATH, new NoModelDataListener()) // 需要读取合并单元格信息 默认不读取 .extraRead(CellExtraTypeEnum.COMMENT).sheet(0).doRead(); 这里写代码 /**

ouyang993670 commented 1 year ago

并且在easyexcel-core-3.1.1.jar包中,目录:com.alibaba.excel->analysis->07-XlsxSaxAnalyser类中。第124行报红。提示在引用得poi 5.2.2包中提供得是Comments,但需要得CommentsTable

ouyang993670 commented 1 year ago

将POI版本降级到4.1.2后解决。希望作者大大能修复5.2.2POI版本得问题

kevinkwok326 commented 1 year ago

将POI版本降级到4.1.2后解决。希望作者大大能修复5.2.2POI版本得问题

同求,easyexcel依赖的poi版本,是否可以升级到5.x系列

Face-cp3 commented 1 year ago

想问下这个问题什么时候可以解决呢?目前看起来需要读取Excel Comment的话,POI 5.x.x版本和Easy Excel3.1.0+是不兼容的

l4n55555 commented 4 months ago

我在项目中也遇到了类似问题。java.lang.NoClassDefFoundError: Could not initialize class org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument

Jukit-Barrett commented 2 months ago

image

引起报错的代码是需要读取批注: .extraRead(CellExtraTypeEnum.COMMENT) poi 5.2.5 可以稳定复现, poi 回退到 4.1.2 版本,可以正常运行。


APPLICATION FAILED TO START


Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

com.alibaba.excel.analysis.v07.XlsxSaxAnalyser.<init>(XlsxSaxAnalyser.java:126)

The following method did not exist:

'org.apache.poi.xssf.model.CommentsTable org.apache.poi.xssf.eventusermodel.XSSFReader$SheetIterator.getSheetComments()'

The calling method's class, com.alibaba.excel.analysis.v07.XlsxSaxAnalyser, was loaded from the following location:

jar:file:/D:/ProgramFiles/Java/.m2/repository/com/alibaba/easyexcel-core/3.3.4/easyexcel-core-3.3.4.jar!/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.class

The called method's class, org.apache.poi.xssf.eventusermodel.XSSFReader$SheetIterator, is available from the following locations:

jar:file:/D:/ProgramFiles/Java/.m2/repository/org/apache/poi/poi-ooxml/5.2.5/poi-ooxml-5.2.5.jar!/org/apache/poi/xssf/eventusermodel/XSSFReader$SheetIterator.class

The called method's class hierarchy was loaded from the following locations:

org.apache.poi.xssf.eventusermodel.XSSFReader.SheetIterator: file:/D:/ProgramFiles/Java/.m2/repository/org/apache/poi/poi-ooxml/5.2.5/poi-ooxml-5.2.5.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.alibaba.excel.analysis.v07.XlsxSaxAnalyser and org.apache.poi.xssf.eventusermodel.XSSFReader$SheetIterator