- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Syntax error in hive-site.xml file
- Labels:
-
Apache Hive
Created ‎06-03-2017 09:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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>
Created ‎06-03-2017 09:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"?>
.
Created ‎06-03-2017 10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I validated XML content with
http://codebeautify.org/xmlvalidator
It's a valid XML.
Also there are no leading space in the first line.
Created on ‎06-03-2017 10:51 AM - edited ‎08-17-2019 11:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
.
You can open the file in "vi" editor to see if the First line has a leading space or hidden character.
Created ‎06-03-2017 10:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎06-03-2017 11:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here you go, attached is the xml configuration file, please validate the content, at my end its a valid content.
Created ‎06-03-2017 11:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please find the attachment..
Created ‎06-03-2017 10:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can also use some online XML validators to validate your XML and to know what is wrong.
Created ‎06-04-2017 12:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"
Created ‎06-04-2017 06:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
