mongodb hadoop连接器无法查询mongo配置单元表

r1zk6ea1  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(521)

我正在使用mongodb hadoop连接器在hadoop中使用配置单元表查询mongodb。
我能执行

select * from mongoDBTestHiveTable;

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

select id from mongoDBTestHiveTable;

它引发以下异常。
配置单元库文件夹中存在以下类。
异常堆栈跟踪:

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.

请给我建议。

kgsdhlau

kgsdhlau1#

您还需要将mongo hadoop-*和mongo驱动程序jar添加到所有worker的mr1/mr2类路径中

相关问题