NonStop/Tandem から Enscribe ファイルをダウンロードし、Windows で処理する小さな FTPS クライアントを作成しています。これを実現するために、Apache Commons Net API を使用しています。
NonStop/Tandem との間でファイルをダウンロードおよびアップロードできます。しかし、 org.apache.commons.net.ftp.FTPClientクラスの下にあるlistFiles()および/またはmlistDir()メソッドを使用して、ファイルとディレクトリを一覧表示できません。
以下は、現在の作業ディレクトリにあるファイルを一覧表示するコードです。
FTPSClient client = new FTPSClient(false);
try {
client.connect(serverAddress, serverPort);
if (FTPReply.isPositiveCompletion(client.getReplyCode())) {
if (client.login(userName, passwd)) {
System.out.println(client.getReplyString());
// Set protection buffer size
client.execPBSZ(0);
// Set data channel protection to private
client.execPROT("P");
// Enter local passive mode
client.enterLocalPassiveMode();
// Get Current Working Directory
client.printWorkingDirectory();
System.out.println(client.getReplyString());
FTPFile[] files = client.listFiles();
// Logout
client.logout();
System.out.println(client.getReplyString());
} else {
System.out.println("Login failed...");
}
// Disconnect from Server
client.disconnect();
System.out.println("Disconnected from Host...");
} else {
System.out.println("Connection to Host failed...");
System.out.println("Error Code - " + reply);
}
} catch (Exception e) {
e.printStackTrace();
}
コードの実行中に次のエラーが発生します。
org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: Nonstop J-series Server : J06.19.
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:169)
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:94)
at org.apache.commons.net.ftp.FTPClient.__createParser(FTPClient.java:3377)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3334)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3012)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3065)
at com.connect.ssl.FTPSTest.main(FTPSTest.java:57)
以下のように FTPClient 構成を UNIX として設定しようとしましたが、役に立ちませんでした。
client.configure(new FTPClientConfig(FTPClientConfig.SYST_UNIX));
誰でもこれで私を助けることができますか?