java.lang.NoSuchMethodError: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont.addNewFamily()

Bha*_*tel 5 java apache-poi

将 poi 升级到版本并添加来自 apache 站点的 jar 包。但是出现以下错误:

 java.lang.NoSuchMethodError: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont.addNewFamily()
Run Code Online (Sandbox Code Playgroud)

然而,已验证该文件JAR在项目中可用并且也可以通过代码访问。

在此输入图像描述

在此输入图像描述

Bha*_*tel 5

根据@axel 的评论,该评论有效,将其发布为更好的覆盖范围的答案。

apache poi版本5.0.0不能再使用ooxml-schemas-1.4.jar

它需要poi-ooxml-lite...jarpoi-ooxml-full...jar. 所以使用ooxml-schemas-1.4.jar时请确保类路径中不存在apache poi 5.0.0