【问题标题】:Apache Hadoop setXIncludeAware UnsupportedOperationExceptionApache Hadoop setXIncludeAware UnsupportedOperationException
【发布时间】:2013-10-26 15:34:46
【问题描述】:

我正在尝试让 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。

【问题讨论】:

  • 这个问题你解决了吗?如果您发布解决方案,那就太好了。我已尝试按照上面链接中的说明添加依赖项,但这并没有解决问题。

标签: java maven exception hadoop xerces


【解决方案1】:

在我的情况下,它是过时的 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.0Here is another article 描述了类似的情况。

【讨论】:

  • 帮助了我。谢谢。
【解决方案2】:

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

in 作为命令 ling arg。也许您没有足够早地设置属性?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-13
    • 2021-12-31
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多