0

我正在使用 MongoDB hadoop 连接器在 hadoop 中使用 hive 表查询 mongoDB。

我能够执行

select * from mongoDBTestHiveTable;

但是当我尝试执行以下查询时

select id from mongoDBTestHiveTable;

它引发以下异常。

以下类存在于 hive lib 文件夹中。

异常堆栈跟踪:

    Diagnostic Messages for this Task:
Error: java.io.IOException: Cannot create an instance of InputSplit class = com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit:Class com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit not found
    at org.apache.hadoop.hive.ql.io.HiveInputFormat$HiveInputSplit.readFields(HiveInputFormat.java:147)
    at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:71)
    at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:42)
    at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:370)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:402)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157)
Caused by: java.lang.ClassNotFoundException: Class com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit not found
    at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626)
    at org.apache.hadoop.hive.ql.io.HiveInputFormat$HiveInputSplit.readFields(HiveInputFormat.java:144)
    ... 10 more

Container killed by the ApplicationMaster.

请指教。

4

1 回答 1

1

您还需要将 mongo-hadoop-* 和 mongo 驱动程序 jar 添加到所有工作人员的 MR1/MR2 类路径中

于 2014-07-14T14:55:33.147 回答