Hi I have been told by another Camel user they had something similar, but I think it was the regular FTP component. The file was downloaded but the FTP library threw an exception. Their problem was their network topology which wasn't to well setup.
Try googling and asking at the JCraft mailing list as its their library Camel uses in the SFTP component. On Tue, Dec 14, 2010 at 1:59 AM, codemickey <[email protected]> wrote: > > I am a new Camel user. > > I am trying to SFTP a file over to a local directory. I am using the > following code for the same: > > public static void main(String args[]) throws Exception { > // create CamelContext > CamelContext context = new DefaultCamelContext(); > > // add our route to the CamelContext > context.addRoutes(new RouteBuilder() { > �...@override > public void configure() { > from("sftp://<account>@<sftp > server>/<dir>?password=<passwd>").to("file:data/outbox"); > } > }); > > // start the route and let it do its work > context.start(); > Thread.sleep(50000); > > // stop the CamelContext > context.stop(); > } > > When i check the output folder, I see that the file is downloaded. But when > the content is stopped, I see the following exception: > > SEVERE: Caused by: > [org.apache.camel.component.file.GenericFileOperationFailedException - > Cannot retrieve file: data/input/Set1.txt] > org.apache.camel.component.file.GenericFileOperationFailedException: Cannot > retrieve file: data/input/Set1.txt > at > org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:482) > at > org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:448) > at > org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:299) > at > org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:155) > at > org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121) > at > org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) > at > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:662) > Caused by: java.io.IOException: inputstream is closed > at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2325) > at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2349) > at com.jcraft.jsch.ChannelSftp.access$800(ChannelSftp.java:36) > at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:1092) > at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:1052) > at org.apache.camel.util.IOHelper.copy(IOHelper.java:104) > at org.apache.camel.util.IOHelper.copy(IOHelper.java:86) > at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:111) > at > org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:475) > ... 14 more > > > > Also one more thing observed is, the for smaller files in a few 100 KBs .. > the file is transferred and i see no exception. But for file in MBs, even if > the file is transferred .. I see the above exception. > > May I get some help on why am I seeing such an exception. Is there some URI > option which I need to add to disconnect/not look for the file once the > transfer is complete? > > > Thanks in advance! > > -- > View this message in context: > http://camel.465427.n5.nabble.com/SFTP-operation-raises-an-exception-but-the-file-is-transferred-tp3303905p3303905.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
