easyexcel web下载Excel抛异常NoClassDefFoundError

jutyujz0  于 2022-12-31  发布在  其他
关注(0)|答案(1)|浏览(1223)

Junit可以执行,可以下载到java目录,web下载就会报错
执行sheet方法的时候,idea打断点出现的异常

e = {NoClassDefFoundError@5398} "java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.excel.write.ExcelBuilderImpl"
detailMessage = "Could not initialize class com.alibaba.excel.write.ExcelBuilderImpl"
cause = {NoClassDefFoundError@5398} "java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.excel.write.ExcelBuilderImpl"
stackTrace = {StackTraceElement[41]@5408}
suppressedExceptions = {Collections$UnmodifiableRandomAccessList@5409} size = 0

有大佬遇到过吗

1tuwyuhd

1tuwyuhd1#

我遇到过这个问题:是easyexcel与poi版本不匹配导致的。
修正后的maven依赖版本:

<dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>easyexcel</artifactId>
        <version>3.0.5</version>
    </dependency>

相关问题