How Do You Troubleshoot a Fatal HDFS Error?

Problem scenario
You run an hdfs command and you get this:

[Fatal Error] core-site.xml:2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
17/09/25 04:21:00 FATAL conf.Configuration: error parsing conf core-site.xml
org.xml.sax.SAXParseException; systemId: file:/home/hadoop/hadoop/etc/hadoop/core-site.xml; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
        at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2531)
        at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2519)
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2590)
        at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2543)
        at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2426)
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1151)
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1123)
        at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1459)
        at org.apache.hadoop.util.GenericOptionsParser.processGeneralOptions(GenericOptionsParser.java:322)
        at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:488)
        at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:170)
        at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:153)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90)
        at org.apache.hadoop.fs.FsShell.main(FsShell.java:378)

What is the problem?

Solution
Find your core-site.xml file.  Make sure there are no blank lines at the top. Delete any blank lines.  The first line should be "<?xml..." and not blank.

For example the top two lines may look like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

Leave a comment

Your email address will not be published. Required fields are marked *