您好, 我们在生产环境中同时运行两台服务器。有时,server1会抛出异常" java.net.SocketException:资源暂时不可用"。以下是详细信息,
提前致谢:)
Failed to connect to ssh server [10.0.0.0:22]
org.apache.sshd.common.RuntimeSshException: Failed to get the session.
at org.apache.sshd.client.future.DefaultConnectFuture.getSession(DefaultConnectFuture.java:43)
at com.abc.OurSshClient.getSessionWithTimeOut(OurSshClient.java:328)
at com.abc.OurSshClient.connect(OurSshClient.java:228)
at com.abc.spi.ConnectionImpl.connectToServer(ConnectionImpl.java:92)
at com.abc.spi.ConnectionImpl.<init>(ConnectionImpl.java:84)
at com.abc.spi.ConnectionFactoryImpl.getInvalidConnections(ConnectionFactoryImpl.java:97)
at com.abc.resource.pool.ConnectionPoolRegistry.runHeartBeatCheck(ConnectionPoolRegistry.java:303)
at com.abc.resource.pool.ConnectionPoolRegistry$CheckConnectionThread.run(ConnectionPoolRegistry.java:498)
Caused by: java.net.SocketException: Resource temporarily unavailable
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:484)
at sun.nio.ch.Net.connect(Net.java:476)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implConnect(UnixAsynchronousSocketChannelImpl.java:326)
at sun.nio.ch.AsynchronousSocketChannelImpl.connect(AsynchronousSocketChannelImpl.java:209)
at org.apache.sshd.common.io.nio2.Nio2Connector.connect(Nio2Connector.java:53)
at org.apache.sshd.SshClient.connect(SshClient.java:298)
at org.apache.sshd.SshClient.connect(SshClient.java:284)
at org.apache.sshd.SshClient.connect(SshClient.java:274)
at com.abc.OurSshClient.getSessionWithTimeOut(OurSshClient.java:317)
... 6 more
private ClientSession getSession(int connectionTimeout) throws TimeoutException, IOException {
ConnectFuture connection;
boolean hasTimedOut = true;
try {
connection = this.client.connect(username, host, port);
hasTimedOut = !connection.await(connectionTimeout);
} catch (Exception e) {
throw new IOException("Failed to connect", e);
}
if (hasTimedOut) {
this.client.stop();
this.client = null;
this.clientStarted = false;
throw new TimeoutException("TimeOut Exception while attempting to connect to [" + host + "]:[" + port + "]");
}
return connection.getSession();
}
答案 0 :(得分:0)
我们刚刚更改了eVip配置文件中的端口范围,现在运行良好。
谢谢大家:)