gpt4 book ai didi

java - Hadoop中的OpenCV库

转载 作者:行者123 更新时间:2023-12-02 21:46:24 25 4
gpt4 key购买 nike

我编写了一个使用OpenCV的简单应用程序。我将所有jar文件放在/ usr / local / hadoop / lib文件夹中。在运行hadoop作业时,出现以下错误:

java.lang.Exception: java.lang.NoClassDefFoundError: com/googlecode/javacv/cpp/opencv_core$CvArr at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:399) Caused by: java.lang.NoClassDefFoundError: com/googlecode/javacv/cpp/opencv_core$CvArr at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:1486) at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1456) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1545) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:686) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:333) at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:231) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_core$CvArr at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 15 more



任何想法如何解决这个问题?

最佳答案

您可以在运行hadoop作业时尝试使用libjars选项。请尝试以下操作:

hadoop jar yourjar.jar MainClass -libjars /path/to/external/jar

更多信息 here

关于java - Hadoop中的OpenCV库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24909096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com