在mac os上配置hadoop namenode时出现yarn-site.xml错误

时间:2015-12-29 03:50:42

标签: java xml macos hadoop

我正在尝试将我的mac配置为hadoop namenode。输入此命令后:

bin/hdfs namenode -format

我收到此错误:

[Fatal Error] yarn-site.xml:3:4: Comment must start with "<!--".
15/12/28 20:32:06 FATAL conf.Configuration: error parsing conf yarn-site.xml
org.xml.sax.SAXParseException; systemId: file:/Library/hadoop-2.7.1/etc/hadoop/yarn-site.xml; 
lineNumber: 3; columnNumber: 4; Comment must start with "<!--".

但是yarn-site.xml文件有该注释。以下是该文件的内容:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-—
  Licensed under the Apache License, Version 2.0 (the "License”);
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
</configuration>

任何建议都将不胜感激。

1 个答案:

答案 0 :(得分:1)

这里有一个小错误:

public class WordCount
{
    public static void main(String [] args){
        int words = 0, lines = 0, characters = 0;
        while (!StdIn.isEmpty()) {
            String line = StdIn.readLine();
            lines++;
            String[] lineWords = line.split("\\s+");
            words += lineWords.length;
            for(String word : lineWords)
                characters += word.length();
        }
        StdOut.println("There are " + lines + "lines");
        StdOut.println("There are " + words + "words");
        StdOut.println("There are " + characters + "characters");
    }
}

这应该是(观察第二个' - '。你需要用“ - ”替换“ - ”):

<!-—

所以更正的文档是(我使用XMLValidator验证它:http://www.xmlvalidation.com/

<!--