Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Mongodb to Hadoop (Cloudera Quickstart): java.lang.NullPointerException: no value for: avgObjSize

Mongodb to Hadoop (Cloudera Quickstart): java.lang.NullPointerException: no value for: avgObjSize

Explorer

[The following question was moved here after originally being posted 12-18-1019 to this thread which was marked 'Solved' 03-23-2016 — Moderator]

Hi Everyone, 

I was trying to load data from mongo to Hadoop (Cloudera Quickstart), initially i was getting error regarding MongoStorage handler and BSON. i resolved this error by placing 5 jar file in "/usr/lib/hive/lib"

1. mongodb-driver-3.12.0.jar

2. mongodb-driver-core-3.12.0.jar

3. mongo-hadoop-core-2.0.2.jar

4. mongo-hadoop-hive-2.0.2.jar

5. bson-3.12.0.jar

also added jar paths in "/usr/lib/hive/conf/hive-env.sh" and restarted cluster. after this i was able to create table. 

 

CREATE EXTERNAL TABLE minute_bars
(
 
id STRUCT<oid:STRING, bsontype:INT>,
  Symbol STRING,
  Timestamp STRING,
  Day INT,
  Open DOUBLE,
  High DOUBLE,
  Low DOUBLE,
  Close DOUBLE,
  Volume INT
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"id":"_id",
 "Symbol":"Symbol", "Timestamp":"Timestamp", "Day":"Day", "Open":"Open", "High":"High", "Low":"Low", "Close":"Close", "Volume":"Volume"}')
TBLPROPERTIES('mongo.uri'='mongodb://127.0.0.1:27017/marketdata.minbars');
 
after this i tried to run select query i am getting below error 
 
Failed with exception java.io.IOException:java.io.IOException: java.lang.NullPointerException: no value for: avgObjSize
 
can anyone help in resolving this issue. Thanks
Don't have an account?
Coming from Hortonworks? Activate your account here