Hive环境搭建启动报错

hive-site.xml文件内容:

 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
 3    Licensed to the Apache Software Foundation (ASF) under one or more
 4    contributor license agreements.  See the NOTICE file distributed with
 5    this work for additional information regarding copyright ownership.
 6    The ASF licenses this file to You under the Apache License, Version 2.0
 7    (the "License"); you may not use this file except in compliance with
 8    the License.  You may obtain a copy of the License at
 9 
10        http://www.apache.org/licenses/LICENSE-2.0
11 
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 --><configuration>
18   <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
19   <!-- WARNING!!! Any changes you make to this file will be ignored by Hive.   -->
20   <!-- WARNING!!! You must make your changes in hive-site.xml instead.         -->
21   <!-- Hive Execution Parameters -->
22   
23     <property>
24         <name>hive.metastore.warehouse.dir</name>
25         <value>/user/hive/warehouse</value>
26     </property>
27   
28     <property>
29         <name>javax.jdo.option.ConnectionURL</name>
30         <value>jdbc:mysql://walloce.one:3306/hive?createDatabaseIfNotExist=true</value>
31     </property>
32     
33     <property>
34         <name>javax.jdo.option.ConnectionDriverName</name>
35         <value>com.mysql.jdbc.Driver</value>
36     </property>
37     
38     <property>
39         <name>javax.jdo.option.ConnectionUserName</name>
40         <value>root</value>
41     </property>
42     
43     <property>
44         <name>javax.jdo.option.ConnectionPassword</name>
45         <value>123456</value>
46     </property>
47 </configuration>

hive-env.sh环境配置文件:

1 # Set HADOOP_HOME to point to a specific hadoop install directory
2 HADOOP_HOME=/opt/module/hadoop-2.5.0
3 
4 # Hive Configuration Directory can be controlled by:
5 export HIVE_CONF_DIR=/opt/module/hive-1.2.1/conf

报错日志内容:

 1 Logging initialized using configuration in file:/opt/module/hive-1.2.1/conf/hive-log4j.properties
 2 [ERROR] Terminal initialization failed; falling back to unsupported
 3 java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
 4         at jline.TerminalFactory.create(TerminalFactory.java:101)
 5         at jline.TerminalFactory.get(TerminalFactory.java:158)
 6         at jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
 7         at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
 8         at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
 9         at org.apache.hadoop.hive.cli.CliDriver.setupConsoleReader(CliDriver.java:787)
10         at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:721)
11         at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
12         at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
13         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
15         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16         at java.lang.reflect.Method.invoke(Method.java:606)
17         at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
18 
19 Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
20         at jline.console.ConsoleReader.<init>(ConsoleReader.java:230)
21         at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
22         at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
23         at org.apache.hadoop.hive.cli.CliDriver.setupConsoleReader(CliDriver.java:787)
24         at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:721)
25         at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
26         at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
27         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
28         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
29         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
30         at java.lang.reflect.Method.invoke(Method.java:606)
31         at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

由日志可以看出是类:

jline.Terminal出问题了!!
其次hadoop下面的 org.apache.hadoop.hive.cli.CliDriver 这个类也出问题了,因为hive是运行在hdfs上的,所以初步判断是jar包冲突了。
所以要检查hadoop下与之对应的jar包和hive的jar包是否一致,不一致要替换成Hive的jar包,
Hadoop中jline的jar包路径:/opt/module/hadoop-2.5.0/share/hadoop/yarn/lib

 

Hive中的jline的jar:

可以看出版本是不一致的,接下来要替换吊hadoop下的jar包,并重启hdfs。

成功启动,没问题!!!



2018-11-22
初心回归,时光已逝!
原文地址:https://www.cnblogs.com/yin1361866686/p/10003482.html