Exception in thread "main" java.net.ConnectException: Call From DESKTOP-API5IFV/192.168.5.1 to hadoop:8020 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(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
在访问hadoop的文件时候用:
hdfs://hadoop/spark/test
导致出现以上的问题,个人认为在hadoop中配置的端口是9000,但是在Windows的环境中访问hadoop时,由于访问的URL里面没有指定端口,系统可能会随机用一个端口号:8020,最终端口号不一致,导致不能访问,最后改成:
hdfs://hadoop:9000/spark/test 就可以了