Skip to content
Advertisement

FTP using Apache commons not working – Error: 550 Dataset not found (FTPid that i am using is getting appended to filename)

I am trying to ftp the file from Linux VM to an AS400 server. I was able to login to server in passive mode but when trying to use the STOR command to upload the file getting below error:

JavaScript

Not sure why the ftpid that i am using is getting prefixed to the filename. Is there any way to avoid it? Below is the sample code that i am using:

JavaScript

Advertisement

Answer

I did some more debugging on doing ftp from linux to as400. And when doing pwd after logging to ftp server its giving message as:
ftp> pwd
257 “‘FTPID.'” is current prefix

And thinking how to remove that prefix so i ran the below command got output as no prefix defined:

ftp> cd ..
200 “” no prefix defined

And after that when i uploaded the file using put command it was uploaded successfully. So i did some research on how to go back one directory using Apache commons.net api’s that i am using and found the CDUP method.

When i ran the FTPClient.cdup() method before uploading the file. I was able to successfully FTP the file from java code as well.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement