java – Apache Hadoop setXIncludeAware UnsupportedOperationException

前端之家收集整理的这篇文章主要介绍了java – Apache Hadoop setXIncludeAware UnsupportedOperationException前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图让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描述了类似的情况.

原文链接:https://www.f2er.com/java/127171.html

猜你在找的Java相关文章