Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with "scp" in ANT build file (Urgent please)

 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am trying to copy my local file to remote host(windows box) using the following syntax in ANT build file:
<scp todir="naveen:password@172.17.5.113/d$/test" trust="true">
<fileset dir="naveencopy"/>
</scp>

But getting the following error
[scp] Connecting to 172.17.5.113:22
BUILD FAILED
C:\Documents and Settings\miracle\Desktop\Ant\windows.xml:12: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection timed out: connect
Total time: 2 seconds

Can any one help me. Your help would be appreciated.

Thanks in Advance........ :-)
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen,

Welcome to JavaRanch Please EaseUp when you ask questions in the forum.

Connecting to 172.17.5.113:22
Connection timed out: connect


This means that the remote host is not able to connect to 172.17.5.113 on port 22. Are you sure the port 22 on this system is open for remote clients?
 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jai,
Thanks for your sincere advice. And the port 22 is being opened.
Do I need to do anything else?
Am I correct at using <scp> in ant to copy my local files to remote windows machine? The syntax in todir="user assword@host:/d$/dir" is correct?

It is showing Connection Refused if the remote machine is Windows, If the remote machine is Linux, it is showing connection time out.

Thank you very much.
[ May 08, 2008: Message edited by: Naveen Kumar Paila ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18169
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably it's the "D$". A dollar sign is the indicator that the name of an Ant property (variable) follows, so to use a dollar sign as part of a filename, you'd have to escape it.

Of course there's also the issue that sharenames ending with "$" are technically not public - it's better to assign an more meaningful name and share that name. But I don't think it actually forbids access to use D$, just hides it from the network browser.
 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim,
Thanks for your reply, and I also have the same issue while playing with Unix box as remote. And I need it to be worked on Windows as my production box is Windows.
In this case do I need to have a shared folder? or disk to be shared? So in the case of putting files into a remote machine I need to eliminate the use of "$". Is that right?
It did not help me...
Any other suggestion please? Is that the problem with my jar or anything?

Thankyou
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there was no SSH daemon running on the UNIX machine, you'd see a "Connection refused" message, not a timeout message. The only way you're going to get a timeout message is if the network packets aren't actually making it to/from the server machine; perhaps there's a firewall in the way. Can you connect directly to the server using a Windows SSH client?

As far as the connection refused message you're getting from the Windows server: that suggests strongly that the Windows server isn't running an ssh daemon. Again, if you could connect to that machine directly using a Windows ssh client like Putty, that would tell us something.
 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
But I am getting Connection Time out message on Unix box. For windows it is Connection refused. Whatever, I need it to work for windows to windows boxes. My requirement is I wanna put my local file or directory in to remote windows machine using ANT script. I am trying to use <scp todir="username :p assword@hostname:/D$/test/" trust="true">
Will it work? Or there is any other method to achieve my requirement?

Help would be greately appreciated...

Thank you

Regards
Naveen

[ May 08, 2008: Message edited by: Naveen Kumar Paila ]
[ May 08, 2008: Message edited by: Naveen Kumar Paila ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen,

I suggested that you get a Windows SCP client and attempt to use it to connect to your server machines (both the Windows one and the UNIX one.) If you can't connect with something like PuTTY, then the problem has nothing to do with Ant -- it's something else. The error messages suggest that a firewall is blocking access to the UNIX server, and that the Windows server is not running an ssh daemon. Until you take down the firewall, and run an ssh daemon on the Windows server, neither Ant nor PuTTY will be able to connect. Do you understand what I'm saying now?
 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest,
Thanks a lot, now I am able to work with Linux box, Now I need to work it with Windows. You said run ssh. I have cygwin in my system, and am not able to connect to Windows. Now I believe that I will definitely get solution from you.. I will be thankful to you.
How to run ssh on windows machine?

Thank you

Regards
Naveen
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To do what I am going to describe, you'd need Cygwin installed on the *server* Windows machine, not the one where Ant is running. Install cygwin, and then run the "sshd" program as a service on that machine. Google found this tutorial to do it:

http://pigtail.net/LRP/printsrv/cygwin-sshd.html
 
Naveen Kumar Paila
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Now I am able to connect I hope. But build failed, and it is showing "No response from Server". I installed openSSH on my windows system.
SSH is running. I am able to connect to Linux from Windows box using ssh through command prompt, and vice versa. But not using my ANT script. It is showing the following :

BUILD FAILED
C:\Documents and Settings\miracle\Desktop\Ant\windows.xml:12: No response from server

Your help made me to get through almost. Thanks, Thank you very much.

Regards
Naveen
[ May 08, 2008: Message edited by: Naveen Kumar Paila ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic