loading native libraries in hadoop reducer?

江枫思渺然 提交于 2019-12-24 14:31:44

问题


I have a native library I need to load for my reduce method and I added it to the distributed cache but when I call System.loadLibrary(mylib.so) in my map method I get an error and failed map task:

Error: no mylib.so in java.library.path

Even though I added it to the distributed cache. Am I missing a step? In my job configuration I call:

DistributedCache.addCacheFile(uri, job.getConfiguration());

Where the uri is the path to mylib.so on the hadoop file system.

This native library depends on many others, all existing on my /hadoop/fs/mystuff/libs on the hadoop fs. I add them all to the distributed cache and I even tried loading all of them in my reduce task using the System.loadLibrary() call. But I keep getting that same java.library.path error. I also tried adding the libraries as command line arguments to the -files flag but I still get the error above.


回答1:


Though exactly not sure why this is happening, check the How to Include Third-Party Libraries in Your Map-Reduce Job blog entry from Cloudera.




回答2:


Do you try our code standalone, not in map-reduce? What I know, System.loadLibrary expect library name without ".so" or ".dll" suffix...



来源:https://stackoverflow.com/questions/12962508/loading-native-libraries-in-hadoop-reducer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!