Java 驼峰SFTP-无法将目录更改为'/';

Java 驼峰SFTP-无法将目录更改为'/';,java,apache-camel,sftp,Java,Apache Camel,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:

我需要通过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: /**
我尝试使用camel SFTP选项
maximumReconnectAttempts=10
serverAliveInterval=60
,并将camel版本更改为2.12.0,然后更改为2.10.7(问题已解决的版本),但这些都没有解决我的问题。 这似乎是一个bug,但奇怪的是,并不是每次我尝试连接到服务器时都会复制它


我很感激任何建议。

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


可以尝试使用一个斜杠,使其成为相对路径
sftp://myserver.com:22/home/tomcat/directory

在添加camel-SFTP选项后,我解决了我的问题
disconnect=true

对我来说,camel版本2.17.1解决了这个问题。我以前的版本是2.15.3和2.15.4。如果有帮助的话。我也有同样的问题,那是因为没有更多的磁盘空间。

我需要使用绝对路径,因为我想连接到不同的机器。如果使用相对路径,则无法连接到所需的目录。请确保您具有执行soI的权限我具有所需的所有权限。有时我能够与成功联系起来,但异常不会被抛出,但有时我不会。也许我会使用骆驼SCP。对我来说也很有用。我还必须设置选项
stepwise=false
。失败仅发生在生成错误的第二个连接上,第一个连接始终成功。将
disconnect=true
强制释放两个连续调用之间的连接。我还必须使用stepwise=false,仅disconnect=true是不够的。使用camel 2.18.1