解决方法:
我把core-site.xml和hdfs-site.xml文件放到工程下,然后new Configuration的时候会自动找到工程下的hdfs-site.xml读取,然而这个hdfs-site.xml中的node01,node02,程序不知道是什么东西,最后把hdfs-site.xml和core-site.xml中的node01 ,node02,node03,node04改为IP地址就解决了问题,不需要把集群端的core-site.xml和hdfs-site.xml文件改动,只改导入工程的core-site.xml和hdfs-site.xml文件。