我想启动 MongoDB Hadoop Streaming 连接器,所以我下载了 Hadoop 的兼容版本(2.2.0)(参见https://github.com/mongodb/mongo-hadoop/blob/master/README.md#apache- hadoop-22 )
我克隆了 git 存储库 mongohadoop,将 build.sbt hadoopRelease 更改为 2.2:
$ cat build.sbt
name := "mongo-hadoop"
organization := "org.mongodb"
hadoopRelease in ThisBuild := "2.2"
然后我启动了:
$ ./sbt package
$ ./sbt mongo-hadoop-streaming/assembly
$ cp core/target/mongo-hadoop-core_2.2.0-1.2.0.jar ../hadoop-2.2.0/lib/
$ cp mongo-2.7.3.jar ../hadoop-2.2.0/lib/ # Previously downloaded
$ cd ../hadoop-2.2.0/
$ ./bin/hadoop jar ../mongo-hadoop/streaming/target/mongo-hadoop-streaming-assembly-1.1.0.jar -mapper ...
我明白了:
Exception in thread "main" java.lang.ClassNotFoundException: com.mongodb.hadoop.streaming.MongoStreamJob
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at org.apache.hadoop.util.RunJar.main(RunJar.java:205)
我不明白为什么,我尝试了几乎所有应该支持流媒体的版本,但我总是遇到同样的错误!
我准确地说我在 Mac OS X 上。谢谢!