2013-11-22 45 views
1

我想用camel-ftp端點(特別是sftp模塊)上傳一個新生成的CSV文件。駱駝SFTP端點沒有上傳文件

我的路線的相關部分如下:

... 
<marshal> 
    <csv></csv> 
</marshal> 
<to uri="file:incoming?tempPrefix=.&amp;fileName=feed.csv" /> 
<to uri="sftp://[email protected]/home/username/file.csv?password=password" /> 
... 

注: 「文件」 在

傳入/ feed.csv

創建成功後,駱駝最後幾行輸出讀取:

[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.SftpOperations - JSCH -> Authentication succeeded (password). 
[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.SftpOperations - Connected to sftp://[email protected]:22 
[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.RemoteFileProducer - Connected and logged in to: Endpoint[sftp://[email protected]/home/username/file.csv?password=xxxxxx] 

但對linuxserver沒有

/home/username/file.csv

注:

我有相同的結果時,配置我的SFTP狂勝爲以下任一操作:

<to uri="sftp://[email protected]/home/username/?password=password" /> 

<to uri="sftp://[email protected]/home/username?password=password" /> 

我缺少什麼?

+0

嘗試沒有第一如此這般直接到你的FTP服務器! –

+0

謝謝。我剛剛嘗試過這個結果。 –

+0

設置DEBUG/TRACE日誌記錄並查看該級別正在記錄的內容。 –

回答

0

的SFTP端點應被指定爲

ftps://[[email protected]]hostname[:port]/directoryname[?options] 

因此,文件名應NE在URI中指定。 您可以使用CamelFileName標題選擇一個文件名。

您可以在FTP Component documentation中找到附加信息。

+0

這是我之前的配置,並且得到了相同的結果 –

+0

我很抱歉混亂,我更新了我的問題以反映這一點。 –

0

當URI的目錄部分存在,就像在:

<to uri="sftp://[email protected]/home/username/?password=password" />
一個文件放置在相對一個目錄的用戶主目錄(〜在這種情況下,用戶名/家/用戶名) - 所以,當你想放置在用戶的主目錄文件直接不指定目錄在所有 - 使用:
<to uri="sftp://[email protected]?password=password" />

當你想放置的主目錄以外的文件使用單獨的主機名雙斜線從目錄:
<to uri="sftp://[email protected]//home/username/?password=password" />

使用駱駝2.10託運。 7。爲記錄器org.apache.camel.component.file.remote.SftpOperations設置跟蹤以驗證行爲。

@ Olivier.Roger - FTPS = SFTP