Changes between Initial Version and Version 1 of waue/2010/0119


Ignore:
Timestamp:
Jan 19, 2010, 11:21:17 AM (14 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2010/0119

    v1 v1  
     1= Debug =
     2{{{
     3#!java
     4public class HelloHadoop {
     5
     6        public class HelloMapper extends
     7                        Mapper<LongWritable, Text, LongWritable, Text> {
     8....
     9        }
     10
     11         public class HelloReducer extends
     12                        Reducer<LongWritable, Text, LongWritable, Text> {
     13...
     14                }
     15        }
     16
     17        public static void main(String[] args) throws IOException,
     18                        InterruptedException, ClassNotFoundException {
     19    }
     20}
     21}}}
     22
     23此一內部類別會引發
     24java.lang.RuntimeException: java.lang.NoSuchMethodException: WordIndex$wordindexM.<init>()
     25
     26問題出在
     27
     28宣告內部類別的  map 或 reduce 的class 前面沒有宣告 static public ,因此正確的應該如下
     29
     30{{{
     31#!java
     32public class HelloHadoop {
     33
     34        static public class HelloMapper extends
     35                        Mapper<LongWritable, Text, LongWritable, Text> {
     36....
     37        }
     38
     39        static public class HelloReducer extends
     40                        Reducer<LongWritable, Text, LongWritable, Text> {
     41...
     42                }
     43        }
     44
     45        public static void main(String[] args) throws IOException,
     46                        InterruptedException, ClassNotFoundException {
     47    }
     48}
     49}}}