我已经写了一个程序连接到ssh服务器使用JSCH库,程序运行良好。在我使用的catch块中
catch(JSchException ee)
{
....
}
当发生错误时,我会收到以下消息:
com.jcraft.jsch.JSchException: java.net.NoRouteToHostException: No route to host
com.jcraft.jsch.JSchException: Auth fail
com.jcraft.jsch.JSchException: timeout: socket is not established
现在我需要在对话框中显示
我有一个很有吸引力的xml,如下所示
<test-case start="1456329345978" stop="1456329352078" status="failed">
<name>SYSTEM_ASSERT_ERRORS</name>
<title>Assert that there are no critical errors</title>
<description type="text">Assert that there are no cr
我有一个这样的场景:
我正试图在数据库服务器上执行一个命令(df -h,即查找磁盘空闲空间的命令)。我正在尝试使用两个JAR文件,即jsch-0.1.51.jar和ganymed-ssh2-build210.jar。
现在,当输入任何worng凭据时,都会导致以下异常
com.jcraft.jsch.JSchException
但当我尝试捕获该异常时,它会说:
Unreachable catch block for JSchException. This exception is never thrown from the try statement body
程序失败了,我怎么才能捕捉到这个
我试图通过SFTP协议使用JSCH发送一个文件。
这是FileService文件
public class FileService {
public void send(){
String str = "this is a test";
InputStream is = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
try {
var channel = setupJsch();
channe
我正在尝试从客户端机器连接sftp服务器。但是com.jcraft.jsch.JSchException:算法协商失败了,我得到了这样的错误。
com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:540)
at com.jcraft.jsch.Session.connect(Session.java:288)
at com.jcraft.jsch.Session.connect(Session.j
我想通过SFTP传输文件。我发现了一个与类似的问题。我尝试了在localhost上的帖子中建议的解决方案。但我得到以下输出下面显示的错误。
输出
preparing the host information for sftp.
Host connected.
sftp channel opened and connected.
2: No such file
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
at com.jcraft.jsch.ChannelSftp._realpath(Channel
当我尝试使用Netbeans(Git-Remote-Push)连接到我的EC2服务器时,我会得到“错误的凭据,在SSH://xx.x.xx.xx/git-repo上建立存储库”。
在我的ide.log中,我得到以下消息:
警告org.netbeans.modules.progress.spi.InternalHandle:不能在org.netbeans.modules.git.client.GitProgressSupport.setProgressMessage(GitProgressSupport.java:247) INFO org.netbeans.modules.git.ui.rep
我正在尝试使用安卓设备连接我的Raspberry Pi。在我调用connect()方法之后,应用程序在没有任何force close error的情况下关闭。我想我的问题是session.connect(1000)。提前谢谢。
public void Connect() {
JSch jsch = new JSch();
try {
jsch.setConfig("StrictHostKeyChecking", "no");
//open a new session
sess
当使用jsch版本0.1.51连接到远程主机时,在ChannelExec上调用Channel.connect()时,我们偶尔会遇到以下异常。
com.jcraft.jsch.JSchException: channel is not opened.
at com.jcraft.jsch.Channel.sendChannelOpen(Channel.java:765)
at com.jcraft.jsch.Channel.connect(Channel.java:151)
at com.jcraft.jsch.Channel.connect(Channel.java:1
我正在尝试使用JSCH库版本0.1.49连接到SFTP远程服务器。每次运行程序时,我都会收到以下错误:
Initializing...
Connection to SFTP server is successfully
com.jcraft.jsch.JSchException: Unable to connect to SFTP server.com.jcraft.jsch.JSchException: failed to send channel request
at shell.MainClass.JschConnect(MainClass.java:95)
at shell.MainC
我对所有的树型包(DiffieHellman.dll、Org.Mentalis.Security.dll、Tamir.SharpSSH.dll)进行了强命名,并且我已经将这些包调用到我的应用程序中,而应用程序必须是强命名的。
但是有一个我不能修复的异常。我写了另一个演示,没有强名称的包,但工作正常。
Connect Exception: Tamir.SharpSsh.jsch.JSchException: Session.connect: System.IO.FileLoadException: Could not load file or assembly 'DiffieHellma
我在实现正确的代码时遇到了麻烦。我有几个对象使用ssh隧道,我不想每次都关闭和打开一个新连接。因此,我实现了单例模式,以获得连接的实例,并将其传递给每个对象。阅读后,似乎单例模式不是正确的编码方式,但我没有看到任何其他方式重新编码我的类。
实例类:
public class ServerConnection {
String ip = "localhost";
String user = "tom1";
String pass = "1";
int port = 22;
private static Session session;
priv