CDH5之Found class jline.Terminal, but interface was expected

hackeruncle發表於2016-04-15
一.背景:
       公司CDH5叢集已經部署完畢,需要透過web介面新增hive元件,一般來說透過web介面來新增,會報兩個錯誤,
一個是配置hive的後設資料的/usr/share/java/mysql-connector-java.jar驅動包,
還有一個錯誤就是如圖:
CDH5之Found class jline.Terminal, but interface was expected CDH5之Found class jline.Terminal, but interface was expected CDH5之Found class jline.Terminal, but interface was expected
二.錯誤明細:

++ exec /opt/cloudera/parcels/CDH/lib/hadoop/bin/hadoop jar /opt/cloudera/parcels/CDH/lib/hive/lib/hive-cli-1.1.0-cdh5.4.8.jar org.apache.hive.beeline.HiveSchemaTool -verbose -dbType mysql -initSchema
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at org.apache.hive.beeline.BeeLineOpts.(BeeLineOpts.java:74)
at org.apache.hive.beeline.BeeLine.(BeeLine.java:119)
at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:346)
at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:326)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:266)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:243)
at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:473)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

三.錯誤分析:
1. ++ exec /opt/cloudera/parcels/CDH/lib/hadoop/bin/hadoop jar /opt/cloudera/parcels/CDH/lib/hive/lib/hive-cli-1.1.0-cdh5.4.8.jar org.apache.hive.beeline.HiveSchemaTool -verbose -dbType mysql -initSchema
這句是配置hive元件的後設資料庫是mysql,在初始化hive的schema,也就是儲存後設資料的表呀等等,所以這句對於我們沒有用

2.[ERROR] Terminal initialization failed; falling back to unsupported
這句說初始化schema失敗,回退到不支援,這句也沒有給出很明顯的錯誤,所以看第三句
3.java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
第三句說明發現類jline.Terminal,但是介面是過期的。初步懷疑是jline的jar版本太低。

四.解決方案:
hadoop-hdfs目錄下存在老版本jline,將hive下的新版本jline的JAR包複製到hadoop-hdfs下
    1.進入hive/lib目錄檢視jline版本和檔案的所在位置
[root@alish1-xxx-01 ~]# cd /opt/cloudera/parcels/CDH-5.4.8-1.cdh5.4.8.p0.4/lib/hive/lib
[root@alish1-xxx-01 lib]# ll jline*
lrwxrwxrwx 1 root root 28 Apr  9 17:05 jline-2.12.jar -> ../../../jars/jline-2.12.jar

    2.進入CDH叢集的jar包資料夾,檢視jline包,一看有四個版本,最新的是2.12
[root@alish1-xxx-01 lib]# cd ../../../jars/
[root@alish1-xxx-01 jars]# ll jline*
-rwxr-xr-x 1 root root  87249 Oct 16 01:36 jline-0.9.94.jar
-rw-r--r-- 1 root root 164623 Oct 16 01:36 jline-2.10.4.jar
-rw-r--r-- 1 root root 206202 Oct 16 01:33 jline-2.11.jar
-rw-r--r-- 1 root root 213854 Oct 16 01:32 jline-2.12.jar

    3.find一下jline包哪些元件會有
[root@alish1-xxx-01 ~]# find / -name jline*
/opt/cloudera/parcels/CDH/lib/crunch/lib/jline-2.10.4.jar
/opt/cloudera/parcels/CDH/lib/llama/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/flume-ng/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/libtools/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-mr1/lib/pig/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-mr1/lib/hive/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-mr1/lib/hive2/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-mr1/lib/sqoop/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-mr1/lib/hcatalog/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/libserver/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-yarn/lib/pig/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-yarn/lib/hive/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-yarn/lib/hive2/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-yarn/lib/sqoop/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/oozie/oozie-sharelib-yarn/lib/hcatalog/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/hadoop-0.20-mapreduce/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/impala/lib/jline-2.12.jar
/opt/cloudera/parcels/CDH/lib/sentry/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/hive/lib/jline-2.12.jar
/opt/cloudera/parcels/CDH/lib/hadoop-httpfs/webapps/webhdfs/WEB-INF/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/whirr/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/hadoop-hdfs/lib/jline-0.9.94.jar
/opt/cloudera/parcels/CDH/lib/sqoop2/client-lib/jline-0.9.94.jar
/opt/cloudera/parcels/CDH/lib/hadoop-kms/webapps/kms/WEB-INF/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/zookeeper/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/jline-2.11.jar
/opt/cloudera/parcels/CDH/jars/jline-2.12.jar
/opt/cloudera/parcels/CDH/jars/jline-2.11.jar
/opt/cloudera/parcels/CDH/jars/jline-2.10.4.jar
/opt/cloudera/parcels/CDH/jars/jline-0.9.94.jar

###透過觀察發現,/opt/cloudera/parcels/CDH/lib/hadoop-hdfs/lib/jline-0.9.94.jar,這個路徑的jar版本過低,才0.9.94版本,所以要替換為最新的版本2.12
(hive元件的最終建立表的資料還是會存在hdfs檔案系統上.肯定就是替換一下就行);
###而sqoop2元件我沒有安裝,所以不需要替換!

    4.cp 最新jline包
[root@alish1-xxx-01 ~]# cp /opt/cloudera/parcels/CDH/jars/jline-2.12.jar /opt/cloudera/parcels/CDH/lib/hadoop-hdfs/lib/
[root@alish1-xxx-01 ~]# cp /opt/cloudera/parcels/CDH/lib/hadoop-hdfs/lib/jline-0.9.94.jar /opt/cloudera/parcels/CDH/lib/hadoop-hdfs/lib/jline-0.9.94.jar.bak
[root@alish1-xxx-01 ~]#

五.驗證結果:
單擊web安裝介面的"重試"按鈕,it's ok!!!











來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30089851/viewspace-2082146/,如需轉載,請註明出處,否則將追究法律責任。

相關文章