java.lang.ClassCastException:无法强制转换为com.google.protobuf.Message

时间:2018-04-13 02:08:04

标签: java hadoop

我想使用hadoop-3.0.1运行以下程序。我已经进口了   Hadoop的客户端API-3.0.1.jar,Hadoop的客户端运行时3.0.1.jar 和hadoop-client-minicluster-3.0.1.jar  :

var fullUrl = window.location.origin + "/" + path

我在日食中获得了优异成绩:

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

public class HDFSFileTest {
public static void main(String[]args) {
    try {
        String fileName="test.txt";
        Configuration conf =new Configuration();
        conf.set("fs.defaultFS","hdfs://localhost:9000");
        conf.set("fs.hdfs.impl","org.apache.hadoop.hdfs.DistributedFileSystem");
        FileSystem fs=FileSystem.get(conf);     
        if(fs.exists(new Path(fileName))) {
            System.out.println("File exists!");
        }
        else {
            System.out.println("File not exists!");
        }
    }
    catch(Exception e){
        e.printStackTrace();
    }
}
}

0 个答案:

没有答案