이것은 공개 토론 here에 게시 된 미해결 문제이지만 어떤 응답도받지 못했기 때문에 여기에서 질문해야한다고 생각했습니다.몽고 - 하둡 간단한 테스트가 NPE로 실패했습니다
데이터 레이어가 인 MongoDB를 사용하는 기존 응용 프로그램이 있습니다. 현재 Mongo의지도 축소 메커니즘을 사용하고 있지만 일부 성능 문제가 발생했습니다. 그래서 나는 그 논리를 구현하는 에 Hadoop을 사용하는 것을 생각했다.
성공과 함께 재무 수익률 예제를 실행했으며 을 생각하여 mongo-hadoop 드라이버를 알게되었습니다. 그래서 빌드 경로에 적절한 jar 파일을 삽입 한 프로젝트를 생성하고 실행했습니다.
이 내 자바 코드 :
final Configuration conf = new Configuration();
MongoConfigUtil.setInputURI(conf, "mongodb://
username:[email protected]/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);"
그러나 나는이 오류가 무엇입니까 : 내가 잘못
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)
를하고있는 중이 야 무엇을? 이것이 Mongo, Hadoop 또는 Mongo-Hadoop 문제입니까?