You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Satish Kumar Kommuri (JIRA)" <ji...@apache.org> on 2008/02/29 14:36:52 UTC

[jira] Created: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

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.

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:password@ipaddress/home/blrproj/console.out" because it does not exist.
org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Andrew Franklin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574184#action_12574184 ] 

Andrew Franklin commented on VFS-201:
-------------------------------------

You're setting an SFTP Property:

SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fso, "no");

and connecting to an FTP server:

"ftp://usename:password@ipaddress/home/blrproj/console.out"

... if your intention is to connect to an SFTP server, try:

"sftp://usename:password@ipaddress/home/blrproj/console.out".

> 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.
> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Alex Marshall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583482#action_12583482 ] 

Alex Marshall commented on VFS-201:
-----------------------------------

No, I'm not facing this problem with symlinks. 

Actually, after spending the last several hours debugging in Eclipse, I traced the problem down to my server not being correctly configured to enable passive mode.  As a result, I'm able to successfully log in, but when org.apache.commons.net.ftp.FTPClient.pasv() is called internally by the FTPClient which is used by the FTP module of commons VFS, it does not properly handle the return code for 500 Invalid command in response to attempting to get the FTP server to change to passive mode.  This was after testing for active mode within the Commons NET FTP client.  To my mind, this code should fallback to active mode if it can't connect in passive.  I was able to remedy my situation by changing the FileSystemOptions I was using and forcefully disabling passive mode, 

ie FtpFileSystemConfigBuilder.sePassiveMode(opt, false)

> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Oliver Haider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574497#action_12574497 ] 

Oliver Haider commented on VFS-201:
-----------------------------------

Hi,

we were facing the same  "<particular file> does not exist" problem last Friday (the 29. of February).

After tracing the Problem for quite a while we figured out the problem was caused by the intercalary day. The Apache-FTP-Code tries to parse the target/source-File Date on the FTP site and can't cope with the 29.02 returning a "null" instead of a Fileobject and thus returns a "file not found".

I think this Problem even occurs if any of the root-directories got a timestamp on that day. Hope we get a fix within the next 4 years ;-)

Regards

Oliver


> 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.
> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Issue Comment Edited: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Oliver Haider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574497#action_12574497 ] 

ohaider edited comment on VFS-201 at 3/3/08 5:38 AM:
-----------------------------------------------------------

Hi,

we were facing the same  "<particular file> does not exist" problem last Friday (the 29. of February).

After tracing the Problem for quite a while we figured out the problem was caused by the intercalary day. The Apache-FTP-Code tries to parse the target/source-File Date on the FTP site and can't cope with the 29.02 returning a "null" instead of a Fileobject and thus returning a "file not found".

I think this Problem even occurs if any of the root-directories got a timestamp on that day. Hope we get a fix within the next 4 years ;-)

Regards

Oliver


      was (Author: ohaider):
    Hi,

we were facing the same  "<particular file> does not exist" problem last Friday (the 29. of February).

After tracing the Problem for quite a while we figured out the problem was caused by the intercalary day. The Apache-FTP-Code tries to parse the target/source-File Date on the FTP site and can't cope with the 29.02 returning a "null" instead of a Fileobject and thus returns a "file not found".

I think this Problem even occurs if any of the root-directories got a timestamp on that day. Hope we get a fix within the next 4 years ;-)

Regards

Oliver

  
> 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.
> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Issue Comment Edited: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Alex Marshall (JIRA)" <ji...@apache.org>.
    [ 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:mypassword@myip: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:mypassword@myip: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:mypassword@myip", 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:its4alenis@192.168.16.109/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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Updated: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Satish Kumar Kommuri (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Satish Kumar Kommuri updated VFS-201:
-------------------------------------

    Description: 
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:password@ipaddress/home/blrproj/console.out" because it does not exist.
org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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)


  was:
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.

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:password@ipaddress/home/blrproj/console.out" because it does not exist.
org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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)



> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Alex Marshall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583469#action_12583469 ] 

Alex Marshall commented on VFS-201:
-----------------------------------

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:mypassword@myip", 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:its4alenis@192.168.16.109/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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "Satish Kumar Kommuri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574949#action_12574949 ] 

Satish Kumar Kommuri commented on VFS-201:
------------------------------------------

Adding to the problem,

The same code works fine from one machine and doesn't work from another. Even though both are Linux machines. Don't know where it is going wrong. Could you please suggest which and all parameters to be verified and corrected in a machine to make this work.

> 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.
> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.


[jira] Commented: (VFS-201) FTP is failing by saying "File doesn't exist" even the file exists and a valid file.

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583474#action_12583474 ] 

James Carman commented on VFS-201:
----------------------------------

Are you guys facing this problem with symbolic links?  I opened another issue which addresses symbolic links that it says is not a file.

> 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:password@ipaddress/home/blrproj/console.out" because it does not exist.
> org.apache.commons.vfs.FileSystemException: Could not copy "ftp://usename:password@ipaddress/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.