首页 > 其他 > 详细

hadoop常见问题汇集

时间:2015-11-02 13:54:57      阅读:268      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!