Debug
public class HelloHadoop { public class HelloMapper extends Mapper<LongWritable, Text, LongWritable, Text> { .... } public class HelloReducer extends Reducer<LongWritable, Text, LongWritable, Text> { ... } } public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { } }
此一內部類別會引發 java.lang.RuntimeException?: java.lang.NoSuchMethodException?: WordIndex?$wordindexM.<init>()
問題出在
宣告內部類別的 map 或 reduce 的class 前面沒有宣告 static public ,因此正確的應該如下
public class HelloHadoop { static public class HelloMapper extends Mapper<LongWritable, Text, LongWritable, Text> { .... } static public class HelloReducer extends Reducer<LongWritable, Text, LongWritable, Text> { ... } } public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { } }
Last modified 15 years ago
Last modified on Jan 19, 2010, 11:21:17 AM