wiki:waue/2010/0119
close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_repos.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.

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