使用'com.mongodb.util.JSONParseException'错误传输BSON文件

时间:2019-04-08 08:03:42

标签: java mongodb hadoop hive bson

我正在尝试将BSON文件传输到Hive,BSON文件已从MongoDB中转储,

mongodump命令像

mongodump -h $host -u $user -p $password -d $db -c $collection -o $output
我用像
这样的罐子 add jar mongo-hadoop-core-2.0.2.jar;add jar mongo-hadoop-hive-2.0.0.jar;add mongo-java-driver-3.2.2.jar;

当我像执行hiveSql时


    create external table sfim_logs_dump (
        id string
        ,ts bigint
        ,reqts string
        ) 
        row format serde 'com.mongodb.hadoop.hive.bsonserde' 
        with serdeproperties(
       'mongo.columns.mapping' = '{"id":"_id","ts":"ts","reqts":"reqts"}')
        stored as inputformat 'com.mongodb.hadoop.mapred.bsonfileinputformat' 
        outputformat 'com.mongodb.hadoop.hive.output.hivebsonfileoutputformat' 
        location '$hdfspath'

错误像


    com.mongodb.util.JSONParseException:
                at com.mongodb.util.JSONParser.read(JSON.java:302)
                at com.mongodb.util.JSONParser.parseObject(JSON.java:263)
                at com.mongodb.util.JSONParser.parse(JSON.java:228)
                at com.mongodb.util.JSONParser.parse(JSON.java:156)
                at com.mongodb.util.JSON.parse(JSON.java:98)
                at com.mongodb.util.JSON.parse(JSON.java:79)
                at com.mongodb.hadoop.hive.BSONSerDe.initialize(BSONSerDe.java:110)
                at org.apache.hadoop.hive.serde2.SerDeUtils.initializeSerDe(SerDeUtils.java:526)

请帮助我解决问题?如何将BSON文件有效地传输到Hive?

0 个答案:

没有答案