[
https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583469#action_12583469
]
alex_marshall edited comment on VFS-201 at 3/30/08 10:45 AM:
-------------------------------------------------------------
Hello,
I'm facing this exact same problem :
FileSystemManager manager = VFS.getManager();
FileSystemOptions options = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setPassiveMode(options, true);
FileObject file = manager.resolveFile("ftp://myusername:[EMAIL
PROTECTED]:21/test.txt", options);
InputStream fileStream = file.getContent().getInputStream();
IOUtils.copy(fileStream, System.out);
file.close();
...and the exception I get is :
Exception in thread "main" org.apache.commons.vfs.FileSystemException: Could
not read from "ftp://myusername:[EMAIL PROTECTED]:21/test.txt" because it is a
not a file.
at
org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1109)
at
org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:317)
at
eu.alenislimited.chequeProcessing.tests.FTPClientTest.test1(FTPClientTest.java:45)
at
eu.alenislimited.chequeProcessing.tests.FTPClientTest.main(FTPClientTest.java:21)
...even though I can open up an FTP client, log in, and verify that the file
'test.txt' is in fact in the root of the FTP after log in.
was (Author: alex_marshall):
Hello,
I'm facing this exact same problem :
FileSystemManager manager = VFS.getManager();
FileSystemOptions options = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setPassiveMode(options, true);
FileObject file = manager.resolveFile("ftp://myusername:[EMAIL
PROTECTED]", options);
InputStream fileStream = file.getContent().getInputStream();
IOUtils.copy(fileStream, System.out);
file.close();
...and the exception I get is :
Exception in thread "main" org.apache.commons.vfs.FileSystemException: Could
not read from "ftp://fcash_alenis:[EMAIL PROTECTED]/test.txt" because it is a
not a file.
at
org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1109)
at
org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:317)
at
eu.alenislimited.chequeProcessing.tests.FTPClientTest.test1(FTPClientTest.java:45)
at
eu.alenislimited.chequeProcessing.tests.FTPClientTest.main(FTPClientTest.java:21)
...even though I can open up an FTP client, log in, and verify that the file
'test.txt' is in fact in the root of the FTP after log in.
> FTP is failing by saying "File doesn't exist" even the file exists and a
> valid file.
> ------------------------------------------------------------------------------------
>
> Key: VFS-201
> URL: https://issues.apache.org/jira/browse/VFS-201
> Project: Commons VFS
> Issue Type: Bug
> Environment: Linux
> Reporter: Satish Kumar Kommuri
>
> Hi,
> We are facing a strange problem with vfs file transfer from one of the FTP
> locations. Java code throws the FileSystemException by saying "<particular
> file> does not exist". On the other hand, FTP to that site and wget are
> working.
> Moreover, from the same machine we are able to FTP from the command line and
> able to download the file using get command.
> And also, wget works fine. No idea the same is failing from java.
> Please find the code snippent below:
> FileSystemOptions fso = new FileSystemOptions();
> SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fso,
> "no");
> FileObject sourceFileObject = fsm.resolveFile(sourceUri, fso);
> String sourceFilePath = sourceFileObject.getName().getPath();
> FileObject targetFileObject = fsm.resolveFile(targetUri, fso);
> FileObject tfo = targetFileObject;
> if(tfo.getType() == FileType.FOLDER)
> tfo =
> targetFileObject.resolveFile(sourceFileObject.getName().getBaseName());
> LOGGER.info("The URI is a file");
> LOGGER.info("Remote Path: [" + sourceFileObject.getName().getPath() +
> "] Local Path: [" + tfo.getName().getPath() + "]");
> copyFile(sourceFileObject, tfo);
> copyFrom method:
> private void copyFile(FileObject sourceFileObject, FileObject
> targetFileObject)
> {
> targetFileObject.copyFrom(sourceFileObject, new
> AllFileSelector());
> copiedFiles.add(sourceFileObject.getName().getPath());
> } catch (FileSystemException e)
> {
> failedFiles.add(sourceFileObject.getName().getPath());
> failedFileExceptions.add(e);
> LOGGER.error("Exception in FileTransferAgent:copyFile
> "+e);
> }
> }
> exception is:
> Exception in FileTransferAgent:copyFile
> org.apache.commons.vfs.FileSystemException: Could not copy
> "ftp://usename:[EMAIL PROTECTED]/home/blrproj/console.out" because it does
> not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy
> "ftp://usename:[EMAIL PROTECTED]/home/blrproj/console.out" because it does
> not exist.
> at
> org.apache.commons.vfs.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:858)
> at FileTransferAgent.copyFile(FileTransferAgent.java:153)
> at FileTransferAgent.copyFiles(FileTransferAgent.java:131)
> at FileTransferAgent.main(FileTransferAgent.java:238)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.