Get your CodeRanch badge!*
The moose likes I/O and Streams and the fly likes Failed uploading file to FTP with simple java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Failed uploading file to FTP with simple java program" Watch "Failed uploading file to FTP with simple java program" New topic
Author

Failed uploading file to FTP with simple java program

Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
Hi,
I opened this new thread in order to be more specific.
When I'm trying to upload file with this ftp program I get an exception :



The exception is :
java.io.FileNotFoundException: PORT 10,40,5,198,8,168: 550 Permission denied.

at sun.net.ftp.FtpClient.readReply(FtpClient.java:251)
at sun.net.ftp.FtpClient.issueCommand(FtpClient.java:208)
at sun.net.ftp.FtpClient.openDataConnection(FtpClient.java:449)
at sun.net.ftp.FtpClient.put(FtpClient.java:609)
at util.FTPClient.putFile(FTPClient.java:62)
at util.FTPClient.main(FTPClient.java:33)


Important :
When I try to access this directory from client like FileZilla for example, I can access this directory and upoload file into it. It just doesnt work with this program.

Does anyone know what i'm missing here ?

Thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19544
    
  16

What's the content of m_sHostFile? Does it include a folder? Does that folder exist?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
Rob Prime wrote:What's the content of m_sHostFile? Does it include a folder? Does that folder exist?


Sorry, It's a sun.net.ftp.FtpClient object, I fixed that and I simplified the code.

Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19544
    
  16

You haven't answered my question. I wasn't talking about m_client but m_sHostFile, the name of the remote file.

Also, you shouldn't use classes that are in packages that start with com.sun, sun or sunw. These are for internal use only, are undocumented and can change or be removed with each new release. If you want a good FTP client, check out Apache Commons Net or JvFTP.
Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
Sorry for that ,
localFile is : "C:\\temp\\RIS141209.zip"
m_sHostFile is : "RIS141209.zip"

Can you be more specific regarding to FTP packages recommandations ?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
http://commons.apache.org/net/ has everything you need.


Ping & DNS - updated with new look and Ping home screen widget
Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
Ulf Dittmer wrote:http://commons.apache.org/net/ has everything you need.


Thanks a lot ! solved that with apache commons net ftp.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Failed uploading file to FTP with simple java program
 
Similar Threads
Gettting Error!!
Problem with FTPClient??
FTP Client
FTPProtocolException:STOR and FTPProtocolException:LIST??
How to upload file to ftp in java