java代码连接hadoop FileSystem 连接hdfs报错:Connection refused: no further information

java代码连接hadoop FileSystem 连接hdfs报错:Connection refused: no further information

确保应用正常启动、JPS该起的进程都要启动的情况下,用java接连hdfs做文件上传报如下错误:

java.net.ConnectException: Call From USER-20150505FN/192.168.1.115 to www.danpinshop.com:9000 failed on connection exception: java.net.ConnectException: Connection refused: no further information; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:783) 
    at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:730) 
    at org.apache.hadoop.ipc.Client.call(Client.java:1351) 
    at org.apache.hadoop.ipc.Client.call(Client.java:1300)

解决办法:
1.可能是权限问题
在hdfs-site.xml文件里添加

<property>  
<name>dfs.permissions</name>  
<value>false</value>  
</property>

2.core-site.xml配置的fs.defaultFS,原来配置的hdfs://localhost:9000更改为机器ip

灵感来自于:

https://www.oschina.net/question/1399571_246927

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值