Mongo Hadoop Connector Issue Mongo Hadoop Connector Issue hadoop hadoop

Mongo Hadoop Connector Issue


Late answer.. It may be helpul for people. I encountered with same problem while playing with Apache Spark.

I think you should set correctly mongo.input.uri and mongo.output.uri which will be used by hadoop and also input and output formats.

/*Correct input and output uri setting on spark(hadoop)*/conf.set("mongo.input.uri", "mongodb://localhost:27017/dbName.inputColName");conf.set("mongo.output.uri", "mongodb://localhost:27017/dbName.outputColName");/*Set input and output formats*/job.setInputFormatClass( MongoInputFormat.class );job.setOutputFormatClass( MongoOutputFormat.class )

Btw, if "mongo.input.uri" or "mongo.output.uri" strings have typos it causes same error.


Replace:

MongoConfigUtil.setInputURI(conf, "mongodb://localhost:27017/fake_data.file");

by:

MongoConfigUtil.setInputURI(job.getConfiguration(), "mongodb://localhost:27017/fake_data.file");

The conf object is already 'consumed' by your job, so you need to set it directly on the configuration of the job.


You haven't shared the complete code so it's hard to tell, but what you've got there does not look consistent with typical usage of the MongoDB Connector for Hadoop.

I would suggest that you start with the examples in github.