问题
I've tried to write a mapreduce app that takes input from a CSV file and aggregates rollover interest per account. I've passed my MRunit tests and everything seems to check out. When I try to run the jar file on my machine (I'm running Hadoop locally), the following error comes up
..........>>
14/07/16 09:09:05 INFO mapred.MapTask: Starting flush of map output
14/07/16 09:09:05 INFO mapred.LocalJobRunner: map task executor complete.
14/07/16 09:09:05 WARN mapred.LocalJobRunner: job_local1566570594_0001
java.lang.Exception: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant
at org.mrIntCalc.CalcInterestMapper.map(CalcInterestMapper.java:38)
at org.mrIntCalc.CalcInterestMapper.map(CalcInterestMapper.java:12)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: java.lang.ClassNotFoundException: org.joda.time.ReadableInstant
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:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 11 more
14/07/16 09:09:05 INFO mapreduce.Job: Job job_local1566570594_0001 running in uber mode : false
14/07/16 09:09:05 INFO mapreduce.Job: map 0% reduce 0%
14/07/16 09:09:05 INFO mapreduce.Job: Job job_local1566570594_0001 failed with state FAILED due to: NA
14/07/16 09:09:05 INFO mapreduce.Job: Counters: 0
I built the app using maven, so joda(v2.3) is listed as a dependency in the pom.xml. Like I said, my unit tests came out all clear. Looking up this issue, I see that some people mention there's a classpath issue at the root of this, although I don't think that's quite it. Any thoughts?
回答1:
Copied the joda-time.jar to a hadoop common library. Probably not the best solution, but at least it works.
回答2:
Check whether joda-time*.jar exists in your classpath/buildpath If it is not mentioned, add it. Else, copy that jar into your lib directory and add it into your classpath.
来源:https://stackoverflow.com/questions/24781932/hadoop-cant-find-joda-dependency