[root@c167 conf]# hive
which: no hbase in (/bin:/usr/bin:/usr/local/rvm/gems/ruby-2.3.8/bin:/usr/local/rvm/gems/ruby-2.3.8@global/bin:/usr/local/rvm/rubies/ruby-2.3.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/java/jdk1.8.0_191/bin:/data/hive/bin:/data/hadoop/bin:/data/sqoop/sqoop-1.4.7/bin:/data/spark-2.1.0-bin-hadoop2.6/bin:/data/scala/scala-2.10.7/bin:/root/bin)
[Fatal Error] hive-site.xml:36:78: The reference to entity "useSSL" must end with the ';' delimiter.
Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; systemId: file:/data/hive/conf/hive-site.xml; lineNumber: 36; columnNumber: 78; The reference to entity "useSSL" must end with the ';' delimiter.
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2517)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2374)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2281)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:1108)
at org.apache.hadoop.hive.conf.HiveConf.getVar(HiveConf.java:3904)
at org.apache.hadoop.hive.conf.HiveConf.getVar(HiveConf.java:3973)
at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:4060)
at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:4003)
at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:81)
at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:65)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:702)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: org.xml.sax.SAXParseException; systemId: file:/data/hive/conf/hive-site.xml; lineNumber: 36; columnNumber: 78; The reference to entity "useSSL" must end with the ';' delimiter.
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:2352)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2340)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2408)
... 17 more
在运行hive命令时出现上述错误,原因是hive-site.xml配置连接数据库mysql字符串值中 & 符合需要转义。将 & 转义为 & 即可。
原来是:
jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8&useSSL=false&createDatabaseIfNotExist=true
修改后: