报错信息:org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr.sizeOfBArray()I
排查思路
- 在项目中找到使用 CTRPr 类的位置,查找该类在什么jar包下
- 使用idea在所在项目pom文件中打开依赖,鼠标右键 -maven - show diagram
- 使用 ctrl + F 快捷键搜索包名称 ,鼠标确定会自动定位,出现红色则代表包出现冲突
- 我项目中引用的版本是5.0.0 ,显示冲突的版本是4.1.2 ,在4.1.2的版本中右键(或者F4)即可跳转到引用此版本的jar包中,发现我的poi 4.1.2的版本是在easyexcel中引用,搜索easyexcel引用位置
解决方案:
- 项目中若只是单纯引用easyexcel,那么可以使用 标签将easyexcel排除
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
</exclusions>
<version>3.2.1</version>
<scope>compile</scope>
</dependency>
-
找到easyexcel引用模块,发现是放在公共模块中引用,将easyexcel放入自己模块中单独引用避免与poi冲突