gpt4 book ai didi

java - Apache Hadoop setXIncludeAware UnsupportedOperationException

转载 作者:可可西里 更新时间:2023-11-01 14:11:50 51 4
gpt4 key购买 nike

我正在尝试让 Apache Hadoop 1.21 运行,但我遇到了这个异常:

Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@2662e5cf:java.lang.UnsupportedOperationException

完整的堆栈跟踪:

13/10/17 17:22:52 ERROR conf.Configuration: Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@2662e5cf:java.lang.UnsupportedOperationException:  setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
java.lang.UnsupportedOperationException: setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
at javax.xml.parsers.DocumentBuilderFactory.setXIncludeAware(DocumentBuilderFactory.java:589)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1131)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1107)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1053)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:460)
at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:132)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:124)
at main.JobExecutor.executeModelCreation(JobExecutor.java:223)
at main.JobExecutor.main(JobExecutor.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:160)

我已经找了将近 3 天的解决方案,我找到了几个网站(比如这个:Hadoop “Failed to set setXIncludeAware(true) for parser” error and how to resolve it),建议将 xerces 和 xalan 添加到 maven 依赖项中。还有其他网站的建议恰恰相反——从类路径中删除所有 xerces 引用。但是没有一个建议的解决方案有效:(

我也尝试过:

System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); 

我的代码。但它也没有帮助:(

正如我所说,我正在使用 Apache Hadoop 1.21 和 JDK 1.7.0-17。

最佳答案

在我的例子中,它是过时的 Maven 组件对 xerces-impl 2.4.0 的依赖。 (由于 mockrunner 1.0.3 在测试阶段使用)。以下托管依赖项已添加到 <dependencyManagemen>部分帮助。

<dependencyManagement>
<dependencies>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
</dependencyManagement>

Hadoop 版本为 2.3.0 . Here is another article描述了类似的情况。

关于java - Apache Hadoop setXIncludeAware UnsupportedOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19438682/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com