Apache Hadoop setXIncludeAware UnsupportedOperationException

Kli*_*nki 10 java hadoop exception xerces maven

我正在尝试运行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
Run Code Online (Sandbox Code Playgroud)

完整堆栈跟踪:

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)
Run Code Online (Sandbox Code Playgroud)

我已经找了近3天的解决方案,我找到了几个网站(比如这个:Hadoop"无法为解析器设置setXIncludeAware(true)"错误以及如何解决它),建议将xerces和xalan添加到maven依赖.还有其他网站,建议几乎相反 - 从类路径中删除所有xerces引用.但非建议的解决方案是工作:(

我也尝试过:

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

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

我正在使用Apache Hadoop 1.21和JDK 1.7.0-17.

Rom*_*nko 12

在我的情况下,它是过时的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>
Run Code Online (Sandbox Code Playgroud)

Hadoop版本是2.3.0.这是另一篇描述类似情况的文章.


Max*_*chi 2

尝试传递 -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

作为命令 ling arg。也许您还没有尽早设置房产?