如何做一个scp在ant文件的ipv6地址



我正在尝试使用apache-ant进行安全复制(scp)文件。我使用的是JSCH库。目前,我能够安全地复制一个文件使用蚂蚁任务的ipv4,其中的scp失败的ipv6地址。

下面是我的ant文件:

CLI输出:

$> ant  config-open-api -lib ~/dev/apache-ant-1.9.5/lib/jsch-0.1.50.jar -Dmachine.ip=fd01:0:101:2606:0:eff:fe57:9336 -Dmachine.root.username=root -Dmachine.root.password=p@ssw0rd
    vboda-mbpro15:functional vboda$ ~/dev/apache-ant-1.9.5/bin/ant  config-open-api -lib ~/dev/apache-ant-1.9.5/lib/jsch-0.1.50.jar -Dvcopssuitevm.ip=fd01:0:101:2606:0:eff:fe57:9336 -Dvcopssuitevm.root.username=root -Dvcopssuitevm.root.password=vmware
    Buildfile: /Users/vboda/perforce/depot/om/main/qe/platform/functional/build.xml
    config-open-api:
         [echo] this is echo!
          [scp] Connecting to fd01:22
    BUILD FAILED
    /Users/vboda/perforce/depot/om/main/qe/platform/functional/build.xml:4: com.jcraft.jsch.JSchException: java.net.UnknownHostException: fd01
        at com.jcraft.jsch.Util.createSocket(Util.java:344)
        at com.jcraft.jsch.Session.connect(Session.java:215)
        at com.jcraft.jsch.Session.connect(Session.java:183)
        at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:225)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:348)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:244)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        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:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:853)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
    Caused by: java.net.UnknownHostException: fd01
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:211)
        at com.jcraft.jsch.Util.createSocket(Util.java:338)

我一直在网上搜索解决方案,但没有找到任何。如果有人能告诉我可能的解决方案,我将不胜感激

ssh状态手册页:

IPv6地址可以用方括号括起来指定。

但是我不确定如何在你的java魔法中推送它

似乎在ipv6主机名的ant scp任务中存在错误。ipv6的主机名解析不正确。参考bug https://bz.apache.org/bugzilla/show_bug.cgi?id=59160

相关内容

  • 没有找到相关文章

最新更新