0
votes

I wrote one simple application in which I am using OpenCV. I put all the jar files in /usr/local/hadoop/lib folder. While running the hadoop job, I am getting the following error:

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

Any idea how to resolve this?

1
can you show, how you run the hadoop job?undefined
This is how I am trying to execute: ./bin/hadoop jar /usr/local/MyApp.jar MainProc /examples/inputfile /usr/local/outputTauqeer Ahmad

1 Answers

0
votes

You could try using the option libjars when running the hadoop job. Try the following:

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

More information here.