小编use*_*628的帖子

Hadoop C++ HDFS测试运行Exception

我正在使用Hadoop 2.2.0并尝试运行此hdfs_test.cpp应用程序:

#include "hdfs.h" 

int main(int argc, char **argv) {

    hdfsFS fs = hdfsConnect("default", 0);
    const char* writePath = "/tmp/testfile.txt";
    hdfsFile writeFile = hdfsOpenFile(fs, writePath, O_WRONLY|O_CREAT, 0, 0, 0);
    if(!writeFile) {
          fprintf(stderr, "Failed to open %s for writing!\n", writePath);
          exit(-1);
    }
    char* buffer = "Hello, World!";
    tSize num_written_bytes = hdfsWrite(fs, writeFile, (void*)buffer, strlen(buffer)+1);
    if (hdfsFlush(fs, writeFile)) {
           fprintf(stderr, "Failed to 'flush' %s\n", writePath); 
          exit(-1);
    }
   hdfsCloseFile(fs, writeFile);
}
Run Code Online (Sandbox Code Playgroud)

我编译了它但是当我用./hdfs_test运行时我有这个:

loadFileSystems error:
(unable to get stack trace …
Run Code Online (Sandbox Code Playgroud)

c++ hadoop exception hdfs

4
推荐指数
2
解决办法
3621
查看次数

标签 统计

c++ ×1

exception ×1

hadoop ×1

hdfs ×1