第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > The method getTextContent() is undefined for the type Node 错误解决办法

The method getTextContent() is undefined for the type Node 错误解决办法

时间:2021-02-24 15:42:00

相关推荐

The method getTextContent() is undefined for the type Node 错误解决办法

在开发项目中,出现一个错误:The method getTextContent() is undefined for the type Node,解决办法:

网上查大部分是说jdk版本问题,发现不是,

原因由于jdk自带的 rt.jar 包和xml-apis.jar 包出现了冲突,引用优先级的不同导致引用了xml-apis.jar的方法,而xml-apis.jar包是依赖于dom4j包的,解决办法如下:

在项目底下的pom.xml文件,找到dom4j所存在的位置,加上下面一段依赖即可:

<exclusions><exclusion><artifactId>xml-apis</artifactId><groupId>xml-apis</groupId></exclusion></exclusions>

总的为:

<dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.5.9</version> <exclusions><exclusion><artifactId>xml-apis</artifactId><groupId>xml-apis</groupId></exclusion></exclusions></dependency>

这样就不会报The method getTextContent() is undefined for the type Node错误了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。