一 问题
严重:Parse error in application web.xml file at [file:路径/WEB-INF/web.xml]
org.xml.sax.SAXNotSupprotedException:not supported setting property http://xml.org/sax/properties/lexical-handler
二 原因
POI 使用 Apache XMLBeans,它在某些时候调用org.xml.sax.XMLReader.setProperty("http://xml.org/sax/properties/lexical-handler", this)
.
- 当 pull-parser 是选定的 SAX 实现时,这会导致错误,因为 pull-parser 不支持此属性。
- 如果类路径上没有 pull-parser,则使用默认的 Xerces 解析器,这没有问题。
错误解析 /index.xhtml:不支持设置属性 http://xml.org/sax/properties/lexical-handler
三 解决
在你引用的dom4j的依赖下排除掉pull-parser
Gradle项目 build.gradle
implementation ('org.dom4j:dom4j:2.1.3'){
exclude module:"pull-parser"
}
Maven 项目 pom.xml
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
<exclusions>
<exclusion>
<artifactId>pull-parser</artifactId>
<groupId>pull-parser</groupId>
</exclusion>
</exclusions>
</dependency>