easyexcel报错:com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoClassDefFoundError: org/

【日常POC问题记录,easyexcel报错】
【报错信息】

com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/FileMagic

【问题代码】

@PostMapping("/testExcel22")
public Payload testExcel(MultipartFile file) {
    try {
        EasyExcel.read(file.getInputStream(), TestExcel.class,new ExcelImportMemberAddressListener()).sheet().doRead();
    } catch (Exception e) {
        e.printStackTrace();
        throw new ApplicationException("XXXXXexcel解析失败");
    }
    return new Payload();
}

【原因】缺少依赖或者依赖冲突,导致找不到类
【解决办法1】引包

<dependency>
    <groupId>com.alibabagroupId>
    <artifactId>easyexcelartifactId>
    <version>2.2.6version>
dependency>
<dependency>
    <groupId>org.apache.poigroupId>
    <artifactId>poiartifactId>
    <version>3.17version>
dependency>
<dependency>
    <groupId>org.apache.poigroupId>
    <artifactId>poi-scratchpadartifactId>
    <version>3.17version>
dependency>
<dependency>
    <groupId>org.apache.poigroupId>
    <artifactId>poi-ooxmlartifactId>
    <version>3.17version>
dependency>

【解决办法2】


你可能感兴趣的:(excel,java,开发语言)