小编Cur*_*ous的帖子

来自java的异常“:org.apache.hadoop.ipc.RpcException:RPC响应超过最大数据长度”

我正在尝试从在我的桌面 Eclipse 中运行的 Java 程序连接到远程 HDFS。我可以连接。但是在尝试读取数据时出现此异常:

引起:org.apache.hadoop.ipc.RpcException: RPC 响应超过最大数据

有人可以帮忙吗?

我有一个非常基本的代码来读取测试数据。错误来自 hdfs.open();

FileSystem hdfs =null;
    String uriPath = "hdfs://" + Constants.HOST + ":" + Constants.PORT+ "/test/hello_world.txt";
    String hadoopBase ="hdfs://" + Constants.HOST + ":" + Constants.PORT;
    Configuration conf = new Configuration();
    conf.set("fs.default.name", hadoopBase);
    URI uri;
    InputStream inputStream = null;
    try {
        uri = new URI(uriPath);
        hdfs =  FileSystem.get(uri, conf);
        Path path = new Path(uri);
        inputStream = hdfs.open(path);
        IOUtils.copyBytes(inputStream, System.out, 4096, false);
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block …
Run Code Online (Sandbox Code Playgroud)

java hadoop

2
推荐指数
1
解决办法
7495
查看次数

标签 统计

hadoop ×1

java ×1