运行bin / hadoop namenode -format时出现致命错误

时间:2012-02-24 15:27:04

标签: java xml hadoop xmldocument

运行bin / hadoop namenode -format

时出现致命错误

使用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

  

致命错误] hdfs-site.xml:5:2:以下文档中的标记   根元素必须格式良好。

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
************************************************************/

1 个答案:

答案 0 :(得分:3)

您的hdfs-site.xml中可能会出现一些XML格式错误。请看第5行。