hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel Tourn (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-104) Reflexive access to non-public class with public ctor requires setAccessible (with some JVMs)
Date Fri, 24 Mar 2006 23:31:49 GMT
    [ http://issues.apache.org/jira/browse/HADOOP-104?page=comments#action_12371821 ] 

Michel Tourn commented on HADOOP-104:
-------------------------------------

class Block registers a factory in its static initializer.

So another thing which may occur here is:
class loading/initialization order is non-deterministic.

If class Block loads before this is called:
  WritableFactories.newInstance(Block.class)
then things work as expected, the Block factory is called.

Else 
WritableFactories does not find a registered factory for Block (yet),
tries to construct the instance reflectively,
and fails as explained in the bug.

In this case an alternate fix is to make sure that all
classes that have a factory method declared as a static initializer
are loaded before they are needed.


> Reflexive access to non-public class with public ctor requires setAccessible (with some
JVMs)
> ---------------------------------------------------------------------------------------------
>
>          Key: HADOOP-104
>          URL: http://issues.apache.org/jira/browse/HADOOP-104
>      Project: Hadoop
>         Type: Bug
>     Reporter: Michel Tourn
>  Attachments: setaccessible.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message