This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Failed uploading file to FTP with simple java program

 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the content of m_sHostFile? Does it include a folder? Does that folder exist?
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://commons.apache.org/net/ has everything you need.
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:http://commons.apache.org/net/ has everything you need.


Thanks a lot ! solved that with apache commons net ftp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic