|
|
-
The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Ronan Lehane 2013-02-09, 17:57
Hi All,
I hope this is the right forum for this type of question so my apologies if not.
I'm looking to write a map reduce program which is giving me the following compilation error: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments (Class<csatAnalysis.MapClass>)
The components involved are:
1. Setting the Mapper //Set the Mapper for the job. Calls MapClass.class job.setMapperClass(MapClass.class);
2. Setting the inputFormat to TextInputFormat //An InputFormat for plain text files. Files are broken into lines. //Either linefeed or carriage-return are used to signal end of line. //Keys are the position in the file, and values are the line of text.. job.setInputFormatClass(TextInputFormat.class);
3. Taking the data into the mapper and processing it public static class MapClass extends Mapper<LongWritable, Text, Text, VectorWritable> { public void map (LongWritable key, Text value,Context context) throws IOException, InterruptedException {
Would anyone have any clues as to what would be wrong with the arguements being passed to the Mapper?
Any help would be appreciated,
Thanks.
-
Re: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Harsh J 2013-02-09, 18:09
Whatever "csatAnalysis.MapClass" the compiler picked up, it appears to not be extending the org.apache.hadoop.mapreduce.Mapper class. From your snippets it appears that you have it all defined properly though. A common issue here has also been that people accidentally import the wrong API (mapred.*) but that doesn't seem to be the case either.
Can you post your full compilable source somewhere? Remove any logic you don't want to share - we'd mostly be interested in the framework definition parts alone.
On Sat, Feb 9, 2013 at 11:27 PM, Ronan Lehane <[EMAIL PROTECTED]> wrote: > Hi All, > > I hope this is the right forum for this type of question so my apologies if > not. > > I'm looking to write a map reduce program which is giving me the following > compilation error: > The method setMapperClass(Class<? extends Mapper>) in the type Job is not > applicable for the arguments (Class<csatAnalysis.MapClass>) > > The components involved are: > > 1. Setting the Mapper > //Set the Mapper for the job. Calls MapClass.class > job.setMapperClass(MapClass.class); > > 2. Setting the inputFormat to TextInputFormat > //An InputFormat for plain text files. Files are broken into lines. > //Either linefeed or carriage-return are used to signal end of > line. > //Keys are the position in the file, and values are the line of > text.. > job.setInputFormatClass(TextInputFormat.class); > > 3. Taking the data into the mapper and processing it > public static class MapClass extends Mapper<LongWritable, Text, Text, > VectorWritable> { > public void map (LongWritable key, Text value,Context context) > throws IOException, InterruptedException { > > Would anyone have any clues as to what would be wrong with the arguements > being passed to the Mapper? > > Any help would be appreciated, > > Thanks.
-- Harsh J
-
Re: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Ronan Lehane 2013-02-09, 18:17
Hi Harsh,
Thanks for getting back so quickly.
The full source code is attached as there's nothing sensitive in it. Coding wouldn't be my strong point so apologies in advance if it looks a mess.
Thanks
On Sat, Feb 9, 2013 at 6:09 PM, Harsh J <[EMAIL PROTECTED]> wrote:
> Whatever "csatAnalysis.MapClass" the compiler picked up, it appears to > not be extending the org.apache.hadoop.mapreduce.Mapper class. From > your snippets it appears that you have it all defined properly though. > A common issue here has also been that people accidentally import the > wrong API (mapred.*) but that doesn't seem to be the case either. > > Can you post your full compilable source somewhere? Remove any logic > you don't want to share - we'd mostly be interested in the framework > definition parts alone. > > On Sat, Feb 9, 2013 at 11:27 PM, Ronan Lehane <[EMAIL PROTECTED]> > wrote: > > Hi All, > > > > I hope this is the right forum for this type of question so my apologies > if > > not. > > > > I'm looking to write a map reduce program which is giving me the > following > > compilation error: > > The method setMapperClass(Class<? extends Mapper>) in the type Job is not > > applicable for the arguments (Class<csatAnalysis.MapClass>) > > > > The components involved are: > > > > 1. Setting the Mapper > > //Set the Mapper for the job. Calls MapClass.class > > job.setMapperClass(MapClass.class); > > > > 2. Setting the inputFormat to TextInputFormat > > //An InputFormat for plain text files. Files are broken into > lines. > > //Either linefeed or carriage-return are used to signal end of > > line. > > //Keys are the position in the file, and values are the line of > > text.. > > job.setInputFormatClass(TextInputFormat.class); > > > > 3. Taking the data into the mapper and processing it > > public static class MapClass extends Mapper<LongWritable, Text, Text, > > VectorWritable> { > > public void map (LongWritable key, Text value,Context context) > > throws IOException, InterruptedException { > > > > Would anyone have any clues as to what would be wrong with the arguements > > being passed to the Mapper? > > > > Any help would be appreciated, > > > > Thanks. > > > > -- > Harsh J >
-
Re: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Harsh J 2013-02-09, 18:35
Your import line of Mapper has the issue. It is imported as below, which can probably be removed as it is unnecessary:
import org.apache.hadoop.mapreduce.Mapper.Context;
But you also would need the line below for the actual class to get found:
import org.apache.hadoop.mapreduce.Mapper;
Adding that line to your list of imports should help resolve it.
I recall some IDEs being odd about these things sometimes, and not reporting the real error correctly. Were you using one? Eclipse?
On Sat, Feb 9, 2013 at 11:47 PM, Ronan Lehane <[EMAIL PROTECTED]> wrote: > Hi Harsh, > > Thanks for getting back so quickly. > > The full source code is attached as there's nothing sensitive in it. > Coding wouldn't be my strong point so apologies in advance if it looks a > mess. > > Thanks > > > On Sat, Feb 9, 2013 at 6:09 PM, Harsh J <[EMAIL PROTECTED]> wrote: >> >> Whatever "csatAnalysis.MapClass" the compiler picked up, it appears to >> not be extending the org.apache.hadoop.mapreduce.Mapper class. From >> your snippets it appears that you have it all defined properly though. >> A common issue here has also been that people accidentally import the >> wrong API (mapred.*) but that doesn't seem to be the case either. >> >> Can you post your full compilable source somewhere? Remove any logic >> you don't want to share - we'd mostly be interested in the framework >> definition parts alone. >> >> On Sat, Feb 9, 2013 at 11:27 PM, Ronan Lehane <[EMAIL PROTECTED]> >> wrote: >> > Hi All, >> > >> > I hope this is the right forum for this type of question so my apologies >> > if >> > not. >> > >> > I'm looking to write a map reduce program which is giving me the >> > following >> > compilation error: >> > The method setMapperClass(Class<? extends Mapper>) in the type Job is >> > not >> > applicable for the arguments (Class<csatAnalysis.MapClass>) >> > >> > The components involved are: >> > >> > 1. Setting the Mapper >> > //Set the Mapper for the job. Calls MapClass.class >> > job.setMapperClass(MapClass.class); >> > >> > 2. Setting the inputFormat to TextInputFormat >> > //An InputFormat for plain text files. Files are broken into >> > lines. >> > //Either linefeed or carriage-return are used to signal end of >> > line. >> > //Keys are the position in the file, and values are the line of >> > text.. >> > job.setInputFormatClass(TextInputFormat.class); >> > >> > 3. Taking the data into the mapper and processing it >> > public static class MapClass extends Mapper<LongWritable, Text, >> > Text, >> > VectorWritable> { >> > public void map (LongWritable key, Text value,Context context) >> > throws IOException, InterruptedException { >> > >> > Would anyone have any clues as to what would be wrong with the >> > arguements >> > being passed to the Mapper? >> > >> > Any help would be appreciated, >> > >> > Thanks. >> >> >> >> -- >> Harsh J > >
-- Harsh J
-
Re: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Ronan Lehane 2013-02-09, 18:40
Hi Harsh,
Yep I'm using Eclipse. I've edited the line below but I'm still getting the same error. I'll chance it outside of eclipse from the command line and see what happens.
Thanks.
On Sat, Feb 9, 2013 at 6:35 PM, Harsh J <[EMAIL PROTECTED]> wrote:
> Your import line of Mapper has the issue. It is imported as below, > which can probably be removed as it is unnecessary: > > import org.apache.hadoop.mapreduce.Mapper.Context; > > But you also would need the line below for the actual class to get found: > > import org.apache.hadoop.mapreduce.Mapper; > > Adding that line to your list of imports should help resolve it. > > I recall some IDEs being odd about these things sometimes, and not > reporting the real error correctly. Were you using one? Eclipse? > > On Sat, Feb 9, 2013 at 11:47 PM, Ronan Lehane <[EMAIL PROTECTED]> > wrote: > > Hi Harsh, > > > > Thanks for getting back so quickly. > > > > The full source code is attached as there's nothing sensitive in it. > > Coding wouldn't be my strong point so apologies in advance if it looks a > > mess. > > > > Thanks > > > > > > On Sat, Feb 9, 2013 at 6:09 PM, Harsh J <[EMAIL PROTECTED]> wrote: > >> > >> Whatever "csatAnalysis.MapClass" the compiler picked up, it appears to > >> not be extending the org.apache.hadoop.mapreduce.Mapper class. From > >> your snippets it appears that you have it all defined properly though. > >> A common issue here has also been that people accidentally import the > >> wrong API (mapred.*) but that doesn't seem to be the case either. > >> > >> Can you post your full compilable source somewhere? Remove any logic > >> you don't want to share - we'd mostly be interested in the framework > >> definition parts alone. > >> > >> On Sat, Feb 9, 2013 at 11:27 PM, Ronan Lehane <[EMAIL PROTECTED]> > >> wrote: > >> > Hi All, > >> > > >> > I hope this is the right forum for this type of question so my > apologies > >> > if > >> > not. > >> > > >> > I'm looking to write a map reduce program which is giving me the > >> > following > >> > compilation error: > >> > The method setMapperClass(Class<? extends Mapper>) in the type Job is > >> > not > >> > applicable for the arguments (Class<csatAnalysis.MapClass>) > >> > > >> > The components involved are: > >> > > >> > 1. Setting the Mapper > >> > //Set the Mapper for the job. Calls MapClass.class > >> > job.setMapperClass(MapClass.class); > >> > > >> > 2. Setting the inputFormat to TextInputFormat > >> > //An InputFormat for plain text files. Files are broken into > >> > lines. > >> > //Either linefeed or carriage-return are used to signal end of > >> > line. > >> > //Keys are the position in the file, and values are the line > of > >> > text.. > >> > job.setInputFormatClass(TextInputFormat.class); > >> > > >> > 3. Taking the data into the mapper and processing it > >> > public static class MapClass extends Mapper<LongWritable, Text, > >> > Text, > >> > VectorWritable> { > >> > public void map (LongWritable key, Text value,Context context) > >> > throws IOException, InterruptedException { > >> > > >> > Would anyone have any clues as to what would be wrong with the > >> > arguements > >> > being passed to the Mapper? > >> > > >> > Any help would be appreciated, > >> > > >> > Thanks. > >> > >> > >> > >> -- > >> Harsh J > > > > > > > > -- > Harsh J >
-
Re: The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments
Ronan Lehane 2013-02-09, 18:44
Thanks for that Harsh. I just have standard compilation errors now that I'll need to look into. Thanks for the help, I don't think I would have ever figured that one out.
Cheers
On Sat, Feb 9, 2013 at 6:40 PM, Ronan Lehane <[EMAIL PROTECTED]> wrote:
> Hi Harsh, > > Yep I'm using Eclipse. > I've edited the line below but I'm still getting the same error. > I'll chance it outside of eclipse from the command line and see what > happens. > > Thanks. > > On Sat, Feb 9, 2013 at 6:35 PM, Harsh J <[EMAIL PROTECTED]> wrote: > >> Your import line of Mapper has the issue. It is imported as below, >> which can probably be removed as it is unnecessary: >> >> import org.apache.hadoop.mapreduce.Mapper.Context; >> >> But you also would need the line below for the actual class to get found: >> >> import org.apache.hadoop.mapreduce.Mapper; >> >> Adding that line to your list of imports should help resolve it. >> >> I recall some IDEs being odd about these things sometimes, and not >> reporting the real error correctly. Were you using one? Eclipse? >> >> On Sat, Feb 9, 2013 at 11:47 PM, Ronan Lehane <[EMAIL PROTECTED]> >> wrote: >> > Hi Harsh, >> > >> > Thanks for getting back so quickly. >> > >> > The full source code is attached as there's nothing sensitive in it. >> > Coding wouldn't be my strong point so apologies in advance if it looks a >> > mess. >> > >> > Thanks >> > >> > >> > On Sat, Feb 9, 2013 at 6:09 PM, Harsh J <[EMAIL PROTECTED]> wrote: >> >> >> >> Whatever "csatAnalysis.MapClass" the compiler picked up, it appears to >> >> not be extending the org.apache.hadoop.mapreduce.Mapper class. From >> >> your snippets it appears that you have it all defined properly though. >> >> A common issue here has also been that people accidentally import the >> >> wrong API (mapred.*) but that doesn't seem to be the case either. >> >> >> >> Can you post your full compilable source somewhere? Remove any logic >> >> you don't want to share - we'd mostly be interested in the framework >> >> definition parts alone. >> >> >> >> On Sat, Feb 9, 2013 at 11:27 PM, Ronan Lehane <[EMAIL PROTECTED]> >> >> wrote: >> >> > Hi All, >> >> > >> >> > I hope this is the right forum for this type of question so my >> apologies >> >> > if >> >> > not. >> >> > >> >> > I'm looking to write a map reduce program which is giving me the >> >> > following >> >> > compilation error: >> >> > The method setMapperClass(Class<? extends Mapper>) in the type Job is >> >> > not >> >> > applicable for the arguments (Class<csatAnalysis.MapClass>) >> >> > >> >> > The components involved are: >> >> > >> >> > 1. Setting the Mapper >> >> > //Set the Mapper for the job. Calls MapClass.class >> >> > job.setMapperClass(MapClass.class); >> >> > >> >> > 2. Setting the inputFormat to TextInputFormat >> >> > //An InputFormat for plain text files. Files are broken into >> >> > lines. >> >> > //Either linefeed or carriage-return are used to signal end >> of >> >> > line. >> >> > //Keys are the position in the file, and values are the line >> of >> >> > text.. >> >> > job.setInputFormatClass(TextInputFormat.class); >> >> > >> >> > 3. Taking the data into the mapper and processing it >> >> > public static class MapClass extends Mapper<LongWritable, Text, >> >> > Text, >> >> > VectorWritable> { >> >> > public void map (LongWritable key, Text value,Context >> context) >> >> > throws IOException, InterruptedException { >> >> > >> >> > Would anyone have any clues as to what would be wrong with the >> >> > arguements >> >> > being passed to the Mapper? >> >> > >> >> > Any help would be appreciated, >> >> > >> >> > Thanks. >> >> >> >> >> >> >> >> -- >> >> Harsh J >> > >> > >> >> >> >> -- >> Harsh J >> > >
|
|