本文介绍了使用ant和scp拒绝权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ant文件中,我将Java war文件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"/>

我的Ant路径中有所需的jar文件jsch-0.1.49.jar @ 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拒绝权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:38