问题描述
在我的 ant 文件中,我将一个 java 战争文件 scp 到测试服务器.一切换到java 1.7,由于项目要求,ant文件抛出了权限被拒绝的错误:
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:
构建失败
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)
一旦我将 JAVA_HOME 环境变量切换回 Java 1.6,一切正常.
As soon as I switch back my JAVA_HOME environment variable back to Java 1.6 everything works fine.
我已经尝试安装两个版本的 java 7(jdk1.7.0_03 和 jdk1.7.0_11),但是我在这两个版本上都遇到了相同的错误.
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.
我的 build.xml 文件中的 scp 任务如下所示:
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"/>
我有所需的 jar 文件 jsch-0.1.49.jar 位于我的 Ant 路径 @ c:\Program Files(x86)\WinAnt\lib
I have the required jar file, jsch-0.1.49.jar located in my Ant path @ c:\Program Files(x86)\WinAnt\lib
为什么当我使用 Java 7 时 scp 不起作用.提前致谢.
Why isnt scp working when I am using Java 7. Thanks in advance.
推荐答案
该问题与 Cisco AnyConnect VPN 客户端有关.原来我所要做的就是在 Windows 的 VPN 属性中禁用 IPv6,问题就消失了.这是互联网上对我有帮助的来源:http://jonathangiles.net/blog/?p=1126
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
这篇关于使用 ant 和 scp 拒绝权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!