Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-104

Reflexive access to non-public class with public ctor requires setAccessible (with some JVMs)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 0.5.0
    • None
    • None

    Description

      Multiple times I have hit this problem which prevents the NameNode from starting.
      The only fix I had so far was to loose all my DFS data...

      Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalAccessException:
      Class org.apache.hadoop.io.WritableFactories can not access a member of
      class org.apache.hadoop.dfs.Block with modifiers "public"
      at org.apache.hadoop.io.WritableFactories.newInstance(WritableFactories.java:49)
      at org.apache.hadoop.io.ArrayWritable.readFields(ArrayWritable.java:81)
      at org.apache.hadoop.dfs.FSDirectory.loadFSEdits(FSDirectory.java:374)
      at org.apache.hadoop.dfs.FSDirectory.loadFSImage(FSDirectory.java:347)
      at org.apache.hadoop.dfs.FSDirectory.<init>(FSDirectory.java:258)
      at org.apache.hadoop.dfs.FSNamesystem.<init>(FSNamesystem.java:151)
      at org.apache.hadoop.dfs.NameNode.<init>(NameNode.java:82)

      According to this,
      http://forum.java.sun.com/thread.jspa?threadID=704100&messageID=4082902
      this is a known issue when using
      reflexive access to a non-public class with public ctor
      (class org.apache.hadoop.dfs.Block is such a class)

      This problem may not occur with all JVM releases.
      (I build on 1.5.0-b64 and run on 1.5.0_05-b05)

      This problem only occured for me when
      I upgrade code or change XML configuration AND
      have existing files in the DFS.
      This problem does not occur when I just stop / restart the NameServer.

      In any case, the attached patch fixes it by calling setAccessible
      before constructing the instance with reflection.

      Attachments

        1. setaccessible.patch
          1 kB
          Michel Tourn

        Issue Links

          Activity

            People

              hairong Hairong Kuang
              michel_tourn Michel Tourn
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: