java common net_java-org.apache.commons.net.io.CopyStreamException:复...

我正在尝试使用以下方法中的代码将在服务器中创建的一些文件复制到FTP.但是奇怪的是我随机地在错误以下,并且我不知道发生了什么.

Exception =org.apache.commons.net.io.CopyStreamException: IOException caught while copying.

以下是我将文件复制到FTP的代码.

public void copyDumpsToFTP() throws SocketException, IOException

{

FTPClient f= new FTPClient();

f.connect(dumpProperties.getProperty("ftpIPAddress"));

boolean flag =f.login(dumpProperties.getProperty("ftpUser"),dumpProperties.getProperty("ftpPassword"));

System.out.println(" is connected to FTP ::"+flag);

// setting fileType to binary

boolean isFileTypeChanged =f.setFileType(FTP.BINARY_FILE_TYPE);

// System.out.println(" Is file type changed to binary :: "+isFileTypeChanged);

// change working directory of FTP Server

boolean isDirectoryChanged =f.changeWorkingDirectory(dumpProperties.getProperty("ftpDirectory"));

System.out.println(" Is the FTP working directory Changed :: "+isDirectoryChanged);

// to copy engineering dump from source to FTP

InputStream inputFileEngg = new FileInputStream(new File(dumpNameEngineering));

boolean isSavedEngg = f.storeFile(dumpProperties.getProperty("dumpNameOfEnggInFTP"), inputFileEngg);

System.out.println("is Engineering dump File Saved in FTP Server :: "+isSavedEngg);

System.out.println(" Engg Dump sucessfully Created and Saved in FTP...");

// to copy correspondance dump from source to FTP

InputStream inputFileCorr = new FileInputStream(new File(dumpNameCorrespondance));

boolean isSavedCorr = f.storeFile(dumpProperties.getProperty("dumpNameOfCorrInFTP"), inputFileCorr);

System.out.println("is Correspondance File Saved in FTP Server :: "+isSavedCorr);

System.out.println(" Correspondance Dump sucessfully Created and Saved in FTP...");

// to copy tmg dump from source to FTP

InputStream inputFileTmg = new FileInputStream(new File(dumpNameTmg));

boolean isSavedTmg = f.storeFile(dumpProperties.getProperty("dumpNameOfTmgInFTP"), inputFileTmg);

System.out.println("is TMG File Saved in FTP Server :: "+isSavedTmg);

System.out.println(" TMG Dump sucessfully Created and Saved in FTP...");

}

程序一直执行到SOP语句FTP工作目录已更改:: true

后者如上所述引发了错误.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值