Apache camel - 将文件写入 ftp 失败
Apache camel - Writing file to ftp failed
下面是我简单的文件组件消费者到ftp生产者组件路由。
from("file://C://fileFolder")
.to("ftp://ftp01.test.com/myfolder/?username=user1234&password=pass1234&delay=5s&ignoreFileNotFoundOrPermissionError=true");
当我粘贴一个简单的文本文件时,出现以下异常提示 "writing failed".
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.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.access1(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]
在谷歌搜索和阅读一些骆驼相关的博客后,以下是我尝试过的试验和案例
- 已检查网络防火墙 - 未阻止
- 已检查 windows 防火墙 - 未阻止
- 已检查手动文件传输到 ftp - 有效
- 已检查 java 使用 commons-net-3 传输文件的方式。7.jar
FTPClient - 工作
仅通过 servicemix 无法正常工作。写入文件失败。有人解决了同样的问题吗?
您的骆驼路线有误:
from("file://C://fileFolder")
.to("ftp://ftp01.test.com/myfolder/?username=user1234&password=pass1234delay=5s&ignoreFileNotFoundOrPermissionError=true");
尝试将 passiveMode=true
添加到 URI。
下面是我简单的文件组件消费者到ftp生产者组件路由。
from("file://C://fileFolder")
.to("ftp://ftp01.test.com/myfolder/?username=user1234&password=pass1234&delay=5s&ignoreFileNotFoundOrPermissionError=true");
当我粘贴一个简单的文本文件时,出现以下异常提示 "writing failed".
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.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.access1(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]
在谷歌搜索和阅读一些骆驼相关的博客后,以下是我尝试过的试验和案例
- 已检查网络防火墙 - 未阻止
- 已检查 windows 防火墙 - 未阻止
- 已检查手动文件传输到 ftp - 有效
- 已检查 java 使用 commons-net-3 传输文件的方式。7.jar FTPClient - 工作
仅通过 servicemix 无法正常工作。写入文件失败。有人解决了同样的问题吗?
您的骆驼路线有误:
from("file://C://fileFolder") .to("ftp://ftp01.test.com/myfolder/?username=user1234&password=pass1234delay=5s&ignoreFileNotFoundOrPermissionError=true");
尝试将 passiveMode=true
添加到 URI。