Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Syntax error in hive-site.xml file

Syntax error in hive-site.xml file

New Contributor

I am not sure what exactly is missing or extra character in this configuration file, but I am getting this error while loading file.

bash: /hive/conf/hive-site.xml: line 1: syntax error near unexpected token newline' bash: /hive/conf/hive-site.xml: line 1:'

My configuration file is :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/hdfs/hive/metastore_db;create=true</value>
<description>
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/hdfs/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>hive.metastore.uris</name>
<value/>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.PersistenceManagerFactoryClass</name>
<value>org.datanucleus.api.jdo.JDOPersistenceManagerFactory</value>
<description>class implementing the jdo persistence</description>
</property>
</configuration>
9 REPLIES 9

Re: Syntax error in hive-site.xml file

Super Mentor

@Chandan Kumar

You should not leave any space before the "<?xml version="1.0" .......?>" line in your XML.

Means you should not have " <?xml version="1.0" .......?>" (this is incorrect because it has leading space)

Means there should be no leading space in that first line. Please remove that space which is present at the beginning of the mentioned line.

Example of incorrect first line:

	<?xml version="1.0" encoding="UTF-8" standalone="no"?>

.

Example of correct first line as following:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

.

Re: Syntax error in hive-site.xml file

New Contributor

I validated XML content with

http://codebeautify.org/xmlvalidator

It's a valid XML.

Also there are no leading space in the first line.

Re: Syntax error in hive-site.xml file

Super Mentor

@Chandan Kumar

Instead of pasting the XML here please attach the file itself so that we can find what is wrong. Based on the content you pasted in your earlier post.... i see it is invalid ... Please see:

Error on->  Line :1 Column :10
Message :XML declaration allowed only at the start of the documen

.

15974-error-hivesite-xml.png

You can open the file in "vi" editor to see if the First line has a leading space or hidden character.

Re: Syntax error in hive-site.xml file

Super Mentor

@Chandan Kumar

The easiest option for you will be to Delete the first line and then type it manually instead of copy pasting from some where, this will avoid the issue of invisible hidden characters.

Highlighted

Re: Syntax error in hive-site.xml file

New Contributor
hive-site.xml

Here you go, attached is the xml configuration file, please validate the content, at my end its a valid content.

Re: Syntax error in hive-site.xml file

New Contributor

hive-site.xml

Please find the attachment..

Re: Syntax error in hive-site.xml file

Super Mentor

You can also use some online XML validators to validate your XML and to know what is wrong.

Re: Syntax error in hive-site.xml file

New Contributor

I think the error is a bash error rather than an XML error. Check the command line you are using to load the file for syntax errors, particularly misplaced <, >, or | characters.

If you still think it is an XML problem and you are sure the first five characters in the file are '<?xml', then you can consider these XML oddities:

  • You have standalone="yes", which is incorrect, but should be ignored by the parser. The standalone document declaration is only considered if you have a <!DOCTYPE... defined (which you don't) and it should only be standalone="yes" if the DTD has information that could change your document such as entity declarations or required attributes.
  • You have an empty value (<value/>) for the property with a name of "hive.metastore.uris"

Re: Syntax error in hive-site.xml file

Hi @Chandan Kumar

Can you elaborate when you say loading file.

What exactly are you doing?

Don't have an account?
Coming from Hortonworks? Activate your account here