2014-08-27 63 views
3

我需要通过SFTP连接到服务器,我收到此错误:骆驼SFTP - 无法更改目录“/”

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: /** 

我试图用骆驼SFTP选项maximumReconnectAttempts=10serverAliveInterval=60和改变骆驼版本到2.12.0,然后到2.10.7(问题已解决的版本),但这些问题都没有解决我的问题。 似乎是一个错误,但奇怪的是,它不是每次都重现我尝试连接到我的服务器。

我很欣赏任何形式的建议。

回答

1

您有双斜线,例如//home/tomcat/directory,表示绝对路径。

也许与尝试,所以其相对路径sftp://myserver.com:22/home/tomcat/directory

+0

那么,我需要使用绝对路径,因为我想连接到不同的机器。如果我使用相对路径,我无法连接到我需要的目录。 – 2014-08-27 14:12:18

+0

请确保您有权这样做 – 2014-08-27 15:07:42

+0

我拥有我需要的所有权限。有时我能够与成功联系在一起,并且不会抛出异常,但有时我不会。也许我会用骆驼SCP .. – 2014-08-28 06:33:01

3

我解决我的问题,增加了骆驼SFTP选项disconnect=true后单斜线。

+0

也为我工作。我还必须把'stepwise = false'选项。失败仅在第二次连接上产生错误,第一次连接总是成功。使用'disconnect = true'强制释放两次连续调用之间的连接。 – 2016-09-01 07:31:52

0

对我来说,骆驼版本2.17.1修复了这个问题。我以前的版本有这个问题是2.15.3和2.15.4。