dom4j下的pull-parser冲突问题

一 问题

严重: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

Gradle 6.5 引入了可选的依赖项#13656

三 解决

在你引用的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>

  • 6
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值