我正在尝试使用JSch类(Java安全通道; jsch-0.1.50.jar)连接到SFTP服务器并在ColdFusion(9.0.2)应用程序内发送文件(其运行在Java 1.7.0_15上)。 相关的基本代码如下:
jsch = classLoader.create("com.jcraft.jsch.JSch").init(); // ColdFusion-specific to load the jar
jschSession = jsch.getSession("myusername", "ftp.example.com", 22);
jschSession.setConfig("StrictHostKeyChecking", "no");
jschSession.setTimeout(60000);
jschSession.setPassword("mypassword");
jschSession.connect();
当连接到Serv-U SFTP服务器时,一旦连接打开,它会立即在Serv-U端给我以下错误:
SSH Protocol Error: packet size exceeds maximum allowed.
Serv-U随后关闭会话,此时JSch会抛出异常:
Session.connect: java.io.IOException: End of IO Stream Read
我对JSch类很新,也许我错过了一些明显的东西,但是我不知道错误可能出现在哪里。使用WinSCP从相同的起点连接到相同的SFTP服务器没有错误。您有什么提示代码做错了或者下一步的故障排除应该在哪里进行?