码迷,mamicode.com
首页 > 其他好文 > 详细

hadoop常见问题汇集

时间:2015-11-02 13:55:33      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

 

1  hadoop conf.addResource  

http://stackoverflow.com/questions/16017538/how-does-configuration-addresource-method-work-in-hadoop

How does Configuration.addResource() method work in hadoop
up vote
0
down vote
favorite
    

Does Configuration.addResource() method load resource file like ClassLoader of java or it just encapsulates ClassLoader class.Because I find it can not use String like "../resource.xml" as argument of addResource() to load resource file out of classpath, this property is just the same as ClassLoader.
Thx!
hadoop
shareimprove this question
    
asked Apr 15 13 at 14:18
foolyoghurt
478
    
        
    
"How does it work" is a different question from "why is my usage not working for me?" Which do you really want to know? – Matt Ball Apr 15 13 at 14:19
add a comment
1 Answer
active
oldest
votes
up vote
2
down vote
    

Browsing the Javadocs and source code for Configuration, Strings are assumed to be classpaths (line 1162), rather than relative to the file system - you should use URLs to reference files on the local file system as follows:

conf.addResource(new File("../resource.xml").toURI().toURL());

shareimprove this answer
    
answered Apr 17 1

 

hadoop常见问题汇集

标签:

原文地址:http://www.cnblogs.com/hdu-2010/p/4929894.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!