Hive在创建表时会抛出错误"无法验证serde:com.cloudera.hive.serde.JSONSerDe"

时间:2016-04-19 05:27:05

标签: java hadoop hive hdfs

使用apache-hive-0.13.1。 创建表配置单元时会抛出错误,如下所示

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Cannot validate serde: com.cloudera.hive.serde.JSONSerDe

表结构是

create external table tweets(id BigInt, created_at String, scource String, favorited Boolean, retweet_count int, 
retweeted_status Struct < 
    text:String,user:Struct< 
        screen_name:String, name:String>>,
    entities Struct<
        urls:Array<Struct<          
             expanded_url:String>>,
        user_mentions:Array<Struct<
            screen_name:String,
            name:String>>,
        hashtags:Array<Struct<text:String>>>,

text String,
user Struct<
    screen_name:String,
    name:String,
    friends_count:int,
    followers_count:int,
     statuses_count:int,
    verified:boolean, 
    utc_offset:int,
    time_zone:String> , 
in_reply_to_screen_name String)
partitioned by (datehour int)
ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe'
location '/home/edureka/sachinG'

在课程中添加json-serde-1.3.6-SNAPSHOT-jar-with-dependencies.jar以解决问题,但没有成功

2 个答案:

答案 0 :(得分:2)

最后,得到了解决方案。问题出在json-serde-1.3.6-SNAPSHOT-jar-with-dependencies.jar 不同的发行版(Cloudera,Azure等)需要不同的JSON-Serde jar文件。手段,serde jar应该兼容那里的分布。

我换了罐子,它对我有用。

答案 1 :(得分:1)

我在使用hive 1.2.1和hbase 0.98时遇到了类似的问题。我按照以下步骤操作, 问题已解决

1)将所有hbase- *文件从hbase / lib位置复制到hive / lib目录

2)验证hive-hbase-handler-1.2.1.jar是否存在于hive / lib中

3)验证hive-serde-1.2.1.jar存在于hive / lib

4)验证了zookeeper-3.4.6.jar是否存在于hive / lib中(如果不是从hbase / lib复制并粘贴到hive / lib)

5)在位于hive / conf下的hive-site.xml(如果不存在,请使用hive-default.xml.template)&#39;

a) hive.aux.jars.path 字段和

b) hive.added.jars.path 字段

提供路径&#39; / usr / local / hive / lib /&#39;。

6)打开配置单元终端并使用以下命令创建表: -

CREATE TABLE emp_hive (
RowKey_HIVE String,
Employee_No int,
Employee_Name String,
Job String,
Mgr int,
Hiredate String,
Salary int,
Commision int,
Department_No int
)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" =":key,details:Employee_No_hbase,details:Employee_Name_hbase,details:job_hbase,details:Mgr_hbase,details:hiredate_hbase,details:salary_hbase,details:commision_hbase,details:department_no_hbase")
TBLPROPERTIES("hbase.table.name"="emp_hbase");