2

byteArrayInputStreamFileとしてFTP サーバーに保存しようとしています。すでにサーバーに接続して作業パスを変更することはできましたが、サーバーにストリームをファイルとして保存するメソッドをトリガーすると、常にfalseが返されます。

Apache FTPClient を使用しています。

誰かが私の間違いのヒントを教えてください!?

ここにコード:

    String filename = "xyz.xml"

    // connection returns true
    connectToFtpServer(ftpHost, ftpUser, ftpPassword, exportDirectory);

    // byteArray is not void
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);

    try {
        // change returns true
        result = ftpClient.changeWorkingDirectory(exportDirectory);

        // storing the file returns false
        result = ftpClient.storeFile(filename, byteArrayInputStream);

        byteArrayInputStream.close();
        ftpClient.logout();
    } catch (...) {
        ...
    } finally {
        // disconnect returns true
        disconnectFromFtpServer();
    }
4

2 に答える 2

0

実際には、無効なユーザー グループによる権限の問題でした。ユーザーをユーザーグループに追加した後、ファイルを再度保存できました。

于 2012-06-28T09:14:59.453 に答える