我正在尝试让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),建议在maven依赖中添加xerces和xalan。也有其他网站,建议几乎相反-删除所有xerces引用类路径。但建议的解决方案中没有一个是有效的:(
我也试着说:
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
我的密码。但也没用:(
我正在使用ApacheHadoop1.21和JDK1.7.0-17。
2条答案
按热度按时间yb3bgrhw1#
在我的例子中,它是过时的maven组件依赖于
xerces-impl 2.4.0
(由于mockrunner 1.0.3
用于测试阶段)。以下托管依赖项添加到<dependencyManagemen>
部分帮助。hadoop版本是
2.3.0
. 下面是另一篇描述类似情况的文章。jchrr9hc2#
尝试传递-djavax.xml.parsers.documentbuilderfactory=com.sun.org.apache.xerces.internal.jaxp.documentbuilderfactoryimpl
作为一个命令行arg。也许你没早点把房子布置好?