hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Urso <antho...@cs.ucla.edu>
Subject Re: ClassCastException
Date Thu, 07 Oct 2010 04:46:01 GMT
 Hadoop is attempting to cast a Date object to WritableComparable, which
Date does not implement, and is causing that exception.

Your keys must implement WritableComparable and your values must
implement Comparable.

On Wed, Oct 6, 2010 at 8:02 PM, Johannes.Lichtenberger
<Johannes.Lichtenberger@uni-konstanz.de> wrote:
> Hello,
>
> I'm getting a ClassCastException, when running my application:
>
> 10/10/07 04:31:10 WARN mapred.LocalJobRunner: job_local_0001
> java.lang.ClassCastException: class java.util.Date
>        at java.lang.Class.asSubclass(Class.java:3018)
>        at
> org.apache.hadoop.mapred.JobConf.getOutputKeyComparator(JobConf.java:617)
>        at
> org.apache.hadoop.mapred.MapTask$MapOutputBuffer.<init>(MapTask.java:791)
>        at
> org.apache.hadoop.mapred.MapTask$NewOutputCollector.<init>(MapTask.java:524)
>        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:613)
>        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)
>        at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:177)
>
> My key is a date (java.util.Date.class).
>
> final Job job = new Job(getConf());
> ...
> job.setOutputKeyClass(java.util.Date.class);
> job.setOutputValueClass(java.util.List.class);
>
> What's wrong?
>
> regards,
> Johannes
>

Mime
View raw message