I need to connect via SFTP to a server and I receive this error:
INFO [org.apache.camel.component.file.remote.SftpOperations.connect]: **Connected to sftp://myserver.com:22**
INFO [org.apache.camel.component.file.remote.RemoteFileProducer.connectIfNecessary]: **Connected and logged in to: Endpoint[sftp://myserver.com:22//home/tomcat/directory?password=******]
INFO [org.apache.camel.component.file.remote.SftpOperations$JSchLogger.log]: JSCH -> **Caught an exception, leaving main loop due to Read timed out**
INFO [org.apache.camel.component.file.remote.SftpOperations$JSchLogger.log]: JSCH -> **Disconnecting from myserver.com port 22**
WARN [org.apache.camel.component.file.remote.RemoteFileProducer.handleFailedWrite]: **Writing file failed with: Cannot change directory to: /**
I tried to use camel SFTP options maximumReconnectAttempts=10
, serverAliveInterval=60
and to change the camel version to 2.12.0 and then to 2.10.7 (versions where the issue is fixed), but none of these fixed my issue.
Seems to be a bug , but the weird thing is that it is not reproduced every time I try to connect to my server.
I appreciate any kind of suggestions.
I solved my issue after adding the camel SFTP option disconnect=true
.
You have double slash, eg //home/tomcat/directory
which indicates an absolute path.
Maybe try with, a single slash so its a relative path sftp://myserver.com:22/home/tomcat/directory
For me, camel version 2.17.1 fixed the issue. My previous versions that had the problem was 2.15.3 and 2.15.4.
来源:https://stackoverflow.com/questions/25524582/camel-sftp-cannot-change-directory-to