Hadoop的Configuration类冲突问题

来源:互联网 发布:冠军对决 知乎 编辑:程序博客网 时间:2024/06/06 04:59
ERROR [org.apache.hadoop.conf.Configuration] - Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@9e1be92:java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"at javax.xml.parsers.DocumentBuilderFactory.setXIncludeAware(DocumentBuilderFactory.java:590)at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1123)at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1099)at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1045)at org.apache.hadoop.conf.Configuration.get(Configuration.java:397)at org.apache.hadoop.conf.Configuration.getInt(Configuration.java:467)at org.apache.hadoop.hdfs.protocol.FSConstants.<clinit>(FSConstants.java:49)at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.createBlockOutputStream(DFSClient.java:3611)at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.nextBlockOutputStream(DFSClient.java:3554)at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.access$2600(DFSClient.java:2749)at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream$DataStreamer.run(DFSClient.java:2989)

在使用Hadoop和一些html解析工具类(比如nekohtml)的时候,会出现在上面的错误,去网上查了下,说是Configuration类冲突引起的,具体的解决办法就是,指定具体的类,这个问题可通过配置jvm的运行时参数来解决,如下:

-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl