The mapper and reducers are not executing on the same machine as your main
program.

That means that they cannot access the data you are talking about.  The
requirement that they be static classes is a reflection of this.

If you need to share data, then you need to write it to the file system and
read it in the configure method on the mapper or reducer.


On 5/21/08 3:17 AM, "Deyaa Adranale" <[EMAIL PROTECTED]>
wrote:

> hello.
> why do we have to set the map and reduce classes as static?
> i need inside them to access some data which is not static. what i
> should do?
> 
> non static map or reduce classes generates the following exception:
> 
> java.lang.RuntimeException: java.lang.NoSuchMethodException:
> hadoop.examples.Simple$MyMapper.()
>     at 
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:45)
>     at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:32)
>     at 
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:53)
>     at org.apache.hadoop.mapred.MapTask.run(MapTask.java:209)
>     at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:1210)
> Caused by: java.lang.NoSuchMethodException: hadoop.examples.Simple$MyMapper.()
>     at java.lang.Class.getConstructor0(Class.java:2705)
>     at java.lang.Class.getDeclaredConstructor(Class.java:1984)
>     at 
> org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:41)
>     ... 4 more
> 
> 
> 
> 
> any ideas?
> 
> thanks in advance,
> 
> Deyaa

Reply via email to