hadoop - 在配置单元中,如何修复"[Fatal Error] hive default.xml:1:1: Content is not allowed in prolog" 错误

启动Hive时出现以下错误


root@ubuntu:~# hive
[Fatal Error] hive-default.xml:1:1: Content is not allowed in prolog.
Exception in thread"main" java.lang.RuntimeException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
 at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1401)
 at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1269)
 at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1200)
 at org.apache.hadoop.conf.Configuration.get(Configuration.java:415)
 at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:663)
 at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:595)
 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:434)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:197)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
 at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
 at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
 at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1300)
 ... 11 more
root@ubuntu:~# 

时间:

正如你所看到的,错误是由于hive-default.xml,

请检查一下这个文件,xml文件开头可能存在空格或其他文本,这会导致错误。

hive-default.xml.template位于安装根目录的conf目录中。

您可能需要创建hive-site.xml来覆盖默认值

...