Apache camel - 将文件写入ftp失败

时间:2016-01-19 09:58:37

标签: java ftp apache-servicemix camel-ftp

下面是我的简单文件组件使用者到ftp生产者组件路由。

from("file://C://fileFolder")
.to("ftp://ftp01.test.com/myfolder/?username=user1234&password=pass1234&delay=5s&ignoreFileNotFoundOrPermissionError=true");

当我粘贴一个简单的文本文件时,我遇到异常,说“写入失败”

2016-01-15 10:55:37,663 | WARN  | C://fileFolder// | RemoteFileProducer               | 117 - org.apache.camel.camel-core - 2.14.1 | Writing file failed with: Error writing file [KURUMDANBANKAYA/F2090281225.txt]
2016-01-15 10:55:37,712 | INFO  | C://fileFolder// | Tracer                           | 117 - org.apache.camel.camel-core - 2.14.1 | ID-ESB01-55798-1452524440559-1-46 >>> (route21) ftp://ftp01.test.com.tr/KURUMDANBANKAYA/?delay=5s&ignoreFileNotFoundOrPermissionError=true&password=xxxxxx&username=garhdisigorta --> OnException[GenericFileOperationFailedException] <<< Pattern:InOnly, Headers:{CamelFileLastModified=1452848134261, CamelFileRelativePath=F2090281225.txt, CamelFileName=F2090281225.txt, CamelFileLength=486, CamelFileNameConsumed=F2090281225.txt, CamelFileNameOnly=F2090281225.txt, CamelFileAbsolutePath=C:\\fileFolder\F2090281225.txt, CamelFilePath=C:\\fileFolder\F2090281225.txt, CamelFileAbsolute=true, CamelFileParent=C:\\fileFolder}, BodyType:org.apache.camel.component.file.GenericFile, Body:[Body is file based: GenericFile[C:\\fileFolder\F2090281225.txt]]
2016-01-15 10:55:37,712 | INFO  | C://fileFolder// | Tracer                           | 117 - org.apache.camel.camel-core - 2.14.1 | ID-ESB01-55798-1452524440559-1-46 >>> OnException[GenericFileOperationFailedException] --> direct-vm://nip-dead-letter-channel <<< Pattern:InOnly, Headers:{CamelFileLastModified=1452848134261, CamelFileRelativePath=F2090281225.txt, CamelFileName=F2090281225.txt, CamelFileLength=486, CamelFileNameConsumed=F2090281225.txt, CamelFileNameOnly=F2090281225.txt, CamelFileAbsolutePath=C:\Target\fileFolder\F2090281225.txt, CamelFilePath=C:\Target\fileFolder\F2090281225.txt, CamelFileAbsolute=true, CamelFileParent=C:\Target\fileFolder}, BodyType:org.apache.camel.component.file.GenericFile, Body:[Body is file based: GenericFile[C:\Target\fileFolder\F2090281225.txt]]
2016-01-15 10:55:37,712 | ERROR | C://fileFolder// | FatalFallbackErrorHandler        | 117 - org.apache.camel.camel-core - 2.14.1 | Exception occurred while trying to handle previously thrown exception on exchangeId: ID-ESB01-55798-1452524440559-1-46 using: [Channel[sendTo(Endpoint[direct-vm://nip-dead-letter-channel])]]. The previous and the new exception will be logged in the following.
2016-01-15 10:55:37,712 | ERROR | C://fileFolder// | FatalFallbackErrorHandler        | 117 - org.apache.camel.camel-core - 2.14.1 | \--> Previous exception on exchangeId: ID-ESB01-55798-1452524440559-1-46
org.apache.camel.component.file.GenericFileOperationFailedException: Error writing file [myfolder/F2090281225.txt]
    at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:279)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:165)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)[237:org.apache.camel.camel-ftp:2.14.1]
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:152)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:304)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:147)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:433)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[117:org.apache.camel.camel-core:2.14.1]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[117:org.apache.camel.camel-core:2.14.1]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_75]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_75]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_75]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_75]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_75]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_75]

在谷歌搜索并阅读一些与骆驼相关的博客后,以下是我试过的试验和案例

  1. 检查网络防火墙 - 不阻止
  2. 检查了Windows防火墙 - 没有阻止
  3. 检查手动文件传输到ftp - working
  4. 使用commons-net-3.7.jar检查java传输文件的方式 FTPClient - 工作
  5. 只有通过servicemix它才能正常工作。写入文件失败。任何人都解决了同样的问题?

2 个答案:

答案 0 :(得分:3)

尝试将passiveMode=true添加到URI。

答案 1 :(得分:0)

你的骆驼路线有错误:

  

从(&#34;文件:// C:// fileFolder&#34)   。为了(&#34; ftp://ftp01.test.com/myfolder/?username=user1234&password= pass1234delay = 5S&安培; ignoreFileNotFoundOrPermissionError =真&#34);