ошибка
org.apache.sshd.common.sshexception: невозможно договориться об обмене ключами на алгоритмы KEX. >
sftpconfig.java
Код: Выделить всё
@Configuration
public class SftpConfig{
@Value("${sftp.host}")
private String host;
@Value("${sftp.port}")
private int port;
@Value("${sftp.user}")
private String user;
@Value("${sftp.password}")
private String password;
@Value("${sftp.remoteDirectory}")
private String remoteDirectory;
@Bean
public SessionFactory sftpSessionFactory(){
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
factory.setHost(host);
factory.setPort(port);
factory.setUser(user);
HostConfigEntry hostConfigEntry = new HostConfigEntry("",host,port,user);
hostConfigEntry.setProperty("StrictHostKeyChecking","no");
hostConfigEntry.setProperty("PreferredAuthentications","password");
factory.setHostConfig(hostConfigEntry);
factory.setPassword(password);
factory.setAllowedUnknownKeys(true);
return new CachingSessionFactory(factory,0)
}
@Bean(name="toSftpChannelTesting")
@ServiceActivator(inputChannel = "toChannelTesting")
public NessageHandler testingMessageHandler(){
SftpMessageHandler handlr = new SftpMessageHandler(sftpSessionFactory());
handlr.setRemoteDirectoryExpression(new LiteralExpression(remoteDirectory));
handlr.setAutoCreateDirectory(false);
handlr.setUseTemproryFileName(false);
return handler;
}
}
Код: Выделить всё
@Service
public class FileUploadAdapter{
@AutoWired private TransferGateway transferGateway;
@Retryable(
retryFor = RetryException.class, maxAttempts = 2,
backoff = @Backoff(delay = 3000))
pubic void transferTestFile(File file){
transferGateway.transferTestFile(file);
}
}
Код: Выделить всё
@MessagingGateway
public interface TransferGateway{
@Gateway(requestChannel = "toChannelTesting")
void transferTestFile(File file);
}
Spring Integration Connection Fail >
Но я получаю ниже ошибку
Java.lang.illegalStateException: пароль должен быть настроен на экземпляре SSHClient < /strong> < /p>
Я хочу использовать предпочтительную аутентификацию в качестве пароля < /p>
Есть ли что -то неправильное, что я делаю здесь. < /p>
Любая помощь с этим много ценится. Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/782 ... lient-inst