hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yi Liu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HDFS-7734) Class cast exception in NameNode#main
Date Wed, 04 Feb 2015 03:33:35 GMT

    [ https://issues.apache.org/jira/browse/HDFS-7734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14304587#comment-14304587
] 

Yi Liu edited comment on HDFS-7734 at 2/4/15 3:32 AM:
------------------------------------------------------

I also just run last hadoop trunk code for some tests and find the same block issue. Thanks
for Arpit reporting it.
As described in description. This issue is caused by the LOG class cast exception in {{NameNode#main}}

Currently we use both {{org.apache.commons.logging.Log}} and {{org.slf4j.Logger}} interfaces
for logging, and by default we use log4j implementation. By using slf4j, we can get some benefits,
such as postpone string construction and it's a bit more efficient. So it's good to use slf4j
especially for heavy access logic.

The only troublesome thing is {{StringUtils#startupShutdownMessage}} and {{SignalLogger}}
class are used by different Hadoop services, ideally we can change all our code to use slf4j,
but it requires refactor for much code. One option is we define overload methods for them
but will duplicate some code logic.
In the patch, I choose another approach to define a {{LogAdapter}}.


was (Author: hitliuyi):
I also just run last hadoop trunk code for some tests and find the same block issue. Thanks
for Arpit reporting it.
As described in description. This issue is caused by the LOG class cast exception in {{NameNode#main}}

Currently we use both {{org.apache.commons.logging.Log}} and {{org.slf4j.Logger}} interfaces
for logging, and by default we use log4j implementation. By using slf4j, we can get some benefits,
such as postpone string construction and it's a bit more efficient. So it's good to use slf4j
especially for heavy access logic.

The only troublesome thing is {{StringUtils#startupShutdownMessage}} and {{SignalLogger}}
class are used by different Hadoop services, ideally we can change all our code to use slf4j,
but it requires refactor for much code. One option is we define overload methods for them
but will duplicate some code logic.
In the patch, I choose another approach to use define a {{LogAdapter}}.

> Class cast exception in NameNode#main
> -------------------------------------
>
>                 Key: HDFS-7734
>                 URL: https://issues.apache.org/jira/browse/HDFS-7734
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.7.0
>            Reporter: Arpit Agarwal
>            Assignee: Yi Liu
>            Priority: Blocker
>         Attachments: HDFS-7734.001.patch
>
>
> NameNode hits the following exception immediately on startup.
> {code}
> 15/02/03 15:50:25 ERROR namenode.NameNode: Failed to start namenode.
> java.lang.ClassCastException: org.apache.log4j.Logger cannot be cast to org.apache.commons.logging.Log
>         at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1557)
> 15/02/03 15:50:25 INFO util.ExitUtil: Exiting with status 1
> {code}
> Location of the exception in NameNode.java:
> {code}
>   public static void main(String argv[]) throws Exception {
>     if (DFSUtil.parseHelpArgument(argv, NameNode.USAGE, System.out, true)) {
>       System.exit(0);
>     }
>     try {
>       StringUtils.startupShutdownMessage(NameNode.class, argv,
>           (org.apache.commons.logging.Log) LogManager.getLogger(LOG.getName()));   <<<<<
Failed here.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message