`
xiaobian
  • 浏览: 579337 次
  • 来自: 北京
社区版块
存档分类
最新评论

HDFS 抛出错误 (java.io.IOException: config())

阅读更多

 

DEBUG [main] Configuration.<init>(211) | java.io.IOException: config()

at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:211)

at com.netqin.hdfs.MyHdfs.isExists(MyHdfs.java:20)

at com.netqin.hdfs.MyHdfs.main(MyHdfs.java:41)

 

在客户端使用API访问HDFS的时候保了一个这样的错误。

 

通过定位代码:

 

 

  /** A new configuration where the behavior of reading from the default 

   * resources can be turned off.

   * 

   * If the parameter {@code loadDefaults} is false, the new instance

   * will not load resources from the default files. 

   * @param loadDefaults specifies whether to load from the default files

   */

  public Configuration(boolean loadDefaults) {

    this.loadDefaults = loadDefaults;

    if (LOG.isDebugEnabled()) {

      LOG.debug(StringUtils.stringifyException(new IOException("config()")));

    }

    synchronized(Configuration.class) {

      REGISTRY.put(this, null);

    }

  }

 

原来是标红的这一行抛出的错误,原因就是HDFS不允许在log4j中使用DEBUG输出日志。如果有则抛出了错误,不过这个错误太不明显了,让人搞得莫名其妙。

 

 

解决办法:

把Log4j文件

# 本文件为日志显示控制文件

log4j.rootCategory=DEBUG,stdout,file

 

改为

log4j.rootCategory=ERROR,stdout,file

 

 

 

分享到:
评论
1 楼 linbin19851010 2011-07-15  
兄弟,没什么好说的了.太感谢了.这解答真是太及时了啊.完成解决了我的问题!

相关推荐

Global site tag (gtag.js) - Google Analytics