java - 运行 bin/hadoop namenode -format 时出现 fatal error

标签 java xml hadoop xmldocument

运行 bin/hadoop namenode -format 时出现 fatal error

使用Windows 7操作系统,在C:\cygwin\usr\local\hadoop-0.20.203.0\conf下编辑hadoop-env.sh文件,

#export JAVA_HOME=C:/Program Files/Java/jdk1.6.0_24
export JAVA_HOME=C:/jdk1.6.0_24.

我将我的 Java 类路径设置为 C:/jdk1.6.0_24

Fatal Error] hdfs-site.xml:5:2: The markup in the document following the root element must be well-formed.

enter code here

$ bin/hadoop namenode -format
12/02/24 07:15:38 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = -PC/10.0.0.11
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 0.20.203.0
STARTUP_MSG:   build = http://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-203 -r 1099333; compiled by 'oom' on Wed May  4 07:57:50 PDT 2011
************************************************************/

12/02/24 07:15:38 FATAL conf.Configuration: bad conf file: top-level element not <configuration>

12/02/24 07:15:38 WARN conf.Configuration: bad conf file: element not <property>

12/02/24 07:15:38 WARN conf.Configuration: bad conf file: element not <property>

[Fatal Error] hdfs-site.xml:5:2: The markup in the document following the root element must be well-formed.

12/02/24 07:15:38 FATAL conf.Configuration: error parsing conf file: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.

12/02/24 07:15:38 ERROR namenode.NameNode: java.lang.RuntimeException: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.

        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1237)
        at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1093)
        at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1037)
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:438)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.setStartupOption(NameNode.java:1124)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1141)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1162)

Caused by: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1142)
        ... 6 more

12/02/24 07:15:38 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at asoni-PC/10.0.0.11
************************************************************/

最佳答案

看起来您的 hdfs-site.xml 中可能存在一些 XML 格式错误。看第 5 行。

关于java - 运行 bin/hadoop namenode -format 时出现 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9433289/

相关文章:

java - JPS : HQL query to check null attribute

java - 向 Clojure 添加类

hadoop - 启用 dfs.image.compress 时会压缩什么?

java - 用艺术字符分隔的分割字符串

java - 源代码是否应该以 UTF-8 格式保存

xml - 使用 xmlstarlet 替换 XML 中的标记值

c# - 分配给 SqlXml 参数的 XML 进行了额外编码?

xml - 方法返回 NodeBuffer 而不是 Elem,这违反了类型检查规则

hadoop - 将具有不同ID的MR作业提交到Hadoop集群

scala - 在 Spark 中处理超过 3GB 的记录大小