Created 06-03-2017 09:56 AM
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
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
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
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
Created 06-03-2017 11:26 AM
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
Please find the attachment..
Created 06-03-2017 10:02 AM
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
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:
Created 06-04-2017 06:53 AM