Permission denied using ant and scp

不问归期 提交于 2019-12-25 04:53:27

问题


In my ant file, I scp a java war file to a test server. As soon as I switched over to java 1.7, due to project requirements, the ant file is throwing a permission denied error:

BUILD FAILED

C:\Users\jdoe\Documents\code\build2\projectName\build.xml:72: com.jcraf
t.jsch.JSchException: java.net.SocketException: Permission denied: connect
        at com.jcraft.jsch.Util.createSocket(Util.java:344)
        at com.jcraft.jsch.Session.connect(Session.java:194)
        at com.jcraft.jsch.Session.connect(Session.java:162)
        at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBas
e.java:223)

As soon as I switch back my JAVA_HOME environment variable back to Java 1.6 everything works fine.

I've tried installing two versions of java 7 (jdk1.7.0_03 and jdk1.7.0_11) but I am getting the same error with both of those versions.

the scp task in my build.xml file looks like this:

 <scp file="${name}.war" todir="${appserver.username}:${appserver.password}@${appserver.ipAddress}:${appserver.testTomcatLocation}" trust="yes"/>  

I have the required jar file, jsch-0.1.49.jar located in my Ant path @ c:\Program Files(x86)\WinAnt\lib

Why isnt scp working when I am using Java 7. Thanks in advance.


回答1:


I'm wondering is perhaps you're sitting behind a corporate firewall?

Perhaps your Java 6 environment has some proxy settings that your new Java 7 installation is missing?

  • How do I set the proxy to be used by the JVM



回答2:


The issue had to do with the Cisco AnyConnect VPN client. Turns out all I had to do was disable IPv6 in the VPN properties in Windows, the issue went away. Here is the source on the internet that helped me: http://jonathangiles.net/blog/?p=1126



来源:https://stackoverflow.com/questions/14490615/permission-denied-using-ant-and-scp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!