java.io.IOException:文件系统在org.apache.hadoop.hdfs.DFSClient.checkOpenDFSClient.java:815关闭

问题描述

这是一个例外:

  java.io.IOException: Filesystem closed
        at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:815)
        at org.apache.hadoop.hdfs.DFSInputStream.readWithStrategy(DFSInputStream.java:868)
        at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:934)
        at java.io.DataInputStream.read(DataInputStream.java:100)
        at org.apache.hadoop.io.IOUtils.copyBytes(IOUtils.java:91)
        at org.apache.hadoop.io.IOUtils.copyBytes(IOUtils.java:59)
        at com.tencent.oceanus.utils.HdfsFileSystem.getFileV2(HdfsFileSystem.java:94)
        at com.tencent.oceanus.utils.Utils.setLocalFilePath(Utils.java:2910)
        at com.tencent.oceanus.server.jobs.JobManager.compile(JobManager.java:231)
        at com.tencent.oceanus.server.jobs.transitions.StartTransitionCallback$StartThread.start(StartTransitionCallback.java:236)
        at com.tencent.oceanus.server.jobs.transitions.StartTransitionCallback$StartThread.run(StartTransitionCallback.java:142)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

这是我的代码。我应该如何修改我的代码?

文件存储在HDFS上,我应该使用hadoop的api吗? 还是如何使错误报告更清晰?

我测试了'so'文件并且可以读取。由于使用了JNI,因此需要读取此So文件。

我已经尝试了很多次,请帮助我。

package com.tencent.wxapp.core.jni;

import java.io.*;
import java.util.List;

public class JNI{
    public native byte[] call(List<String> jList);
    static{
      

        InputStream is = JNI.class.getResourceAsStream("/JNIdll.so");

        File file = null;
        
        try {
            file = File.createTempFile("lib",".so");
        } catch (IOException e) {
            e.printStackTrace();
        }
        OutputStream os = null;
        try {
            os = new FileOutputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        byte[] buffer = new byte[1024];
        int length = 0;
        while (true) {
            try {
                if (!((length = is.read(buffer)) != -1)) break;
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                os.write(buffer,length);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            os.close();
        } catch (IOException e) {
            e.printStackTrace();
        }



        System.load(file.getAbsolutePath());
        file.deleteOnExit();


    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...