This is an open issue posted in the support forum here but since I didn't get any response, I thought I should try asking here.

I have an existing application that uses MongoDB as the data layer. Currently I am using Mongo's Map reduce mechanism but, I am facing some performance issues. So I thought of using Hadoop to implement that logic.

I have run the treasury-yield example with success and thought of creating a simple project just to get to know the mongo-hadoop driver. So I created a project inserted the appropriate jar files in the build path and run it.

This is my java code:

final Configuration conf = new Configuration(); 
    MongoConfigUtil.setInputURI( conf, "mongodb:// 
                          username:passw...@192.168.1.198/locations" ); 
    MongoConfigUtil.setOutputURI( conf, "mongodb://localhost/ 
                                 test.out" ); 
    System.out.println( "Conf: " + conf ); 
    final Job job = new Job( conf, "word count" ); 
    job.setJarByClass( WordCount.class ); 
    job.setMapperClass( TokenizerMapper.class ); 
    job.setCombinerClass( IntSumReducer.class ); 
    job.setReducerClass( IntSumReducer.class ); 
    job.setOutputKeyClass( Text.class ); 
    job.setOutputValueClass( IntWritable.class ); 
    job.setInputFormatClass( MongoInputFormat.class ); 
    job.setOutputFormatClass( MongoOutputFormat.class ); 
    System.exit( job.waitForCompletion( true ) ? 0 : 1 );" 

but I am getting this error:

Conf: Configuration: core-default.xml, core-site.xml 
12/05/20 14:12:03 WARN util.NativeCodeLoader: Unable to load native- 
hadoop library for your platform... using builtin-java classes where 
applicable 
12/05/20 14:12:03 WARN mapred.JobClient: Use GenericOptionsParser for 
parsing the arguments. Applications should implement Tool for the 
same. 
12/05/20 14:12:03 WARN mapred.JobClient: No job jar file set.  User 
classes may not be found. See JobConf(Class) or 
JobConf#setJar(String). 
12/05/20 14:12:03 INFO mapred.JobClient: Cleaning up the staging area 
file:/tmp/hadoop-maximos/mapred/staging/maximos1261801897/.staging/ 
job_local_0001 
Exception in thread "main" java.lang.NullPointerException 
        at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java: 
796) 
        at com.mongodb.DBApiLayer.doGetCollection(DBApiLayer.java:116) 
        at com.mongodb.DBApiLayer.doGetCollection(DBApiLayer.java:43) 
        at com.mongodb.DB.getCollection(DB.java:81) 
        at 
com.mongodb.hadoop.util.MongoSplitter.calculateSplits(MongoSplitter.java: 
51) 
        at 
com.mongodb.hadoop.MongoInputFormat.getSplits(MongoInputFormat.java: 
51) 
        at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java: 
962) 
        at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:979) 
        at org.apache.hadoop.mapred.JobClient.access$600(JobClient.java:174) 
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:897) 
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850) 
        at java.security.AccessController.doPrivileged(Native Method) 
        at javax.security.auth.Subject.doAs(Subject.java:416) 
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.j ava: 
1093) 
        at 
org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java: 
850) 
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:500) 
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) 
        at 
com.mongodb.hadoop.examples.wordcount.WordCount.main(WordCount.java: 
100)

What I am doing wrong? is this a Mongo, Hadoop or Mongo-Hadoop problem?

link|improve this question

74% accept rate
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.