hi All, I am trying to connect to a remote server using the Ssh-session. Please find the below script is was using to connect. I am not sure what is the exact mistake i am doing. But i am getting the following exception every time when i connect. Some please help/guide how we i can do. Thanks in advance. Config: -------- ANT Version: Apache Ant(TM) version 1.8.2 compiled on December 20 2010 JCP version: jsch-0.1.44.jar Java version:java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02) Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode) Script: ------- <project name="Moving the file to remote server using" default="default" basedir="."> <target name="default" description="Moving files using the tunneling"> <sshsession host="jumpserver" username="jumpserver_userid" password="jumpserverpassword" trust="true" localtunnels="9090:<<remote_server>>:22"> <scp file="myfile.txt" todir="<<remoteserver_userid>>@localhost:/webapp/jboss/4.3/jboss-as/batch/ANTTest" trust="true" password="<<remoteserver_password>>" port="9090"> </scp> </sshsession> <targer> </project> Output: --------- Buildfile: <<localpath>>\build.xml CopyFiles1: [sshsession] Connecting to jumpserver:22 [sshexec] Connecting to 127.0.0.1:9090 BUILD FAILED <<localpath>>\build.xml:23: com.jcraft.jsch.JSchException: connection is closed by foreign host at com.jcraft.jsch.Session.connect(Session.java:240) at com.jcraft.jsch.Session.connect(Session.java:154) at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:223) at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:190) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.optional.ssh.SSHSession.execute(SSHSession.java:173) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Total time: 53 seconds