我在hadoop工作,突然有一次我为我的图像处理程序创建了runnable jar这个错误发生了它与opencv本机库路径的关系
使用eclipse时可以使用以下方式设置路径:
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
但是在使用hadoop执行runnable jar时会出错。 谁能纠正?
hduser@master:/home/mnh/Desktop$ hadoop jar opencv19.jar /usr/local/hadoop/input/cars.mp4 /usr/local/hadoop/cars89
17/06/07 16:15:37 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/06/07 16:15:39 INFO client.RMProxy: Connecting to ResourceManager at master/192.168.137.52:8050
17/06/07 16:15:40 WARN mapreduce.JobSubmitter: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
17/06/07 16:16:08 INFO input.FileInputFormat: Total input paths to process : 1
17/06/07 16:16:08 INFO mapreduce.JobSubmitter: number of splits:1
17/06/07 16:16:09 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1496831815466_0009
17/06/07 16:16:09 INFO impl.YarnClientImpl: Submitted application application_1496831815466_0009
17/06/07 16:16:09 INFO mapreduce.Job: The url to track the job: http://master:8088/proxy/application_1496831815466_0009/
17/06/07 16:16:09 INFO mapreduce.Job: Running job: job_1496831815466_0009
17/06/07 16:16:20 INFO mapreduce.Job: Job job_1496831815466_0009 running in uber mode : false
17/06/07 16:16:20 INFO mapreduce.Job: map 0% reduce 0%
17/06/07 16:16:29 INFO mapreduce.Job: Task Id : attempt_1496831815466_0009_m_000000_0, Status : FAILED
Error: no libopencv_core.so in java.library.path
17/06/07 16:16:37 INFO mapreduce.Job: Task Id : attempt_1496831815466_0009_m_000000_1, Status : FAILED
Error: no libopencv_core.so in java.library.path
17/06/07 16:16:45 INFO mapreduce.Job: Task Id : attempt_1496831815466_0009_m_000000_2, Status : FAILED
Error: no libopencv_core.so in java.library.path
17/06/07 16:16:54 INFO mapreduce.Job: map 100% reduce 100%
17/06/07 16:16:55 INFO mapreduce.Job: Job job_1496831815466_0009 failed with state FAILED due to: Task failed task_1496831815466_0009_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0
17/06/07 16:16:56 INFO mapreduce.Job: Counters: 12
Job Counters
Failed map tasks=4
Launched map tasks=4
Other local map tasks=3
Data-local map tasks=1
Total time spent by all maps in occupied slots (ms)=26582
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=26582
Total vcore-seconds taken by all map tasks=26582
Total megabyte-seconds taken by all map tasks=27219968
Map-Reduce Framework
CPU time spent (ms)=0
Physical memory (bytes) snapshot=0
Virtual memory (bytes) snapshot=0
答案 0 :(得分:0)
您收到的错误消息与无法使用OpenCV的工作人员有关,因为它未安装在相应的计算机上。所以解决方案是在安装了Nodemanager组件的集群机器上安装OpenCV(那些将执行任务的集群机器)。为了能够使用System.loadLibrary()
方法加载库,您需要将so
文件的位置添加到PATH
系统变量。