参考:https://blog.csdn.net/weixin_43976226/article/details/125449959

 

 

我的代码报:

java.lang.NoClassDefFoundError: Could not initialize class org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook
at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:475) ~[poi-ooxml-5.2.2.jar!/:5.2.2]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:232) ~[poi-ooxml-5.2.2.jar!/:5.2.2]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:226) ~[poi-ooxml-5.2.2.jar!/:5.2.2]
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:214) ~[poi-ooxml-5.2.2.jar!/:5.2.2]

 

添加jar包:

<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.1.0</version>
</dependency>
就可以了
posted on 2022-08-25 11:45  毛会懂  阅读(2900)  评论(0编辑  收藏  举报