问题
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