aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Problem with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problem with "scp" in ANT build file (Urgent please) " Watch "Problem with "scp" in ANT build file (Urgent please) " New topic
Author

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

Naveen Kumar Paila
Greenhorn

Joined: May 07, 2008
Posts: 6
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

Joined: Jul 20, 2005
Posts: 10263
    
168

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?


[My Blog] [JavaRanch Journal]
Naveen Kumar Paila
Greenhorn

Joined: May 07, 2008
Posts: 6
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

Joined: Jun 25, 2001
Posts: 16233
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Naveen Kumar Paila
Greenhorn

Joined: May 07, 2008
Posts: 6
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Naveen Kumar Paila
Greenhorn

Joined: May 07, 2008
Posts: 6
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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

Joined: May 07, 2008
Posts: 6
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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

Joined: May 07, 2008
Posts: 6
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 ]
 
wood burning stoves
 
subject: Problem with "scp" in ANT build file (Urgent please)