javax.jdo.option.ConnectionURL配置的问题

    Hive安装过程中出现 The reference to entity "createDatabaseIfNotExist" must end with the ';' delimiter.问题,具体如下所示:

[Fatal Error] hive-site.xml:132:95: The reference to entity "createDatabaseIfNotExist" must end with the ';' delimiter.

14/10/23 11:15:04 FATAL conf.Configuration: error parsing conf file:/usr/local/apache-hive-0.13.1-bin/conf/hive-site.xml

org.xml.sax.SAXParseException; systemId: file:/usr/local/apache-hive-0.13.1-bin/conf/hive-site.xml; lineNumber: 132; columnNumber: 95; The reference to entity "createDatabaseIfNotExist" must end with the ';' delimiter.

    因为hive-site.xml中的javax.jdo.option.ConnectionURL配置项引起的,如下所示:

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://localhost:3306/hive_hdp?characterEncoding=UTF-8&createDatabaseIfNotExist=true</value>

<description>JDBC connect string for a JDBC metastore</description>

</property>

    正确配置如下:

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://localhost:3306/hive_hdp?characterEncoding=UTF-8&createDatabaseIfNotExist=true</value>

<description>JDBC connect string for a JDBC metastore</description>

</property>

    这是因为xml文件中的编码规则引起的。

    在xml文件中有以下几类字符要进行转义替换如下表所示:

143241_jy1V_1169607.png

    所以javax.jdo.option.ConnectionURL项中的&符号需要用&表示。


转载于:https://my.oschina.net/u/1169607/blog/336628