Connection failed using Apache SSH


Using Eclipse Polarion Connectors the connection fails when we use ssh apache, with the same use case, it works fine using trilead.

In the class, open(SVNRepositoryImpl repository) method, you get the firstAuthentication, try it and get the next one if it fails (except when catching an IOException).
However, in the openConnection method, you try to connect using SshConnection and if there is an exception, you throw an IOException, so it stops the method.

Eclipse connectors uses SVNClientImpl, the implementation of SVNClient does not allow to define the authentication manager as a default one using private key, so we must set it using the prompts. The client has 4 providers, and the good one is not the first one. As the apache.SshHost.openConnection throws an IOException, at the first provider, the other ones are not tried.

In apache SshHost openConnection, adding a catch on org.apache.sshd.common.SshException throwing an new SshAuthenticationException solves the problem :

private SshConnection openConnection() throws IOException {
	try {
		return new SshConnection(this);
	} catch (SshException e) {
		throw new SshAuthenticationException("Failed to connect to " + toString() + " : " + e.getMessage());
	} catch (Exception e) {
		throw new IOException("Failed to connect to "+toString(), e);

Also, be careful, there are two classes named SshAuthenticationException in the package and the package. In the example of the correction above I deleted the SshAuthenticationException class located in apache package.

Best regards,

Cyprien Rouzies