Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 33746 invoked from network); 14 Dec 2010 08:31:12 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Dec 2010 08:31:12 -0000 Received: (qmail 90262 invoked by uid 500); 14 Dec 2010 08:31:11 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 90067 invoked by uid 500); 14 Dec 2010 08:31:11 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 90053 invoked by uid 99); 14 Dec 2010 08:31:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Dec 2010 08:31:10 +0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qw0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Dec 2010 08:31:04 +0000 Received: by qwk4 with SMTP id 4so513158qwk.32 for ; Tue, 14 Dec 2010 00:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=MgDujK8PJl2p74YcX65jQLpIyzjM4rrKh7Q00JtPfsU=; b=eKi1yqv5g0wavhai7FhKxJAmEAw63GlfBKufL4yZNcvQyqlzpLI8ul03IvJEYIFWnO C3ychf17JgFo2d9LqgNjXFQgVOycfm1m94J9USQxev0Ara2dlKPBUHeqydQ/g309o+11 dKHvyt2djfc9dZI3iqCg2CO9X4yrKwGTehaIU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=XcU/vQ2twdW/TwA9TYHgRsMT41Z93ZIHQIR5bdPDKOaptEjAjoT7xW5qT1cz9EJHyM xC4kTxKI0/osp3ZPGscpgnWkDiGNZCpaBs4yARDynkxNk6DEMLoqTllQPxG4wOGn/V9W uDQX8qeMNrhYleLpbL9dbEcoyOtZ2kToOWKMA= Received: by 10.229.89.208 with SMTP id f16mr4662647qcm.168.1292315443289; Tue, 14 Dec 2010 00:30:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.68.104 with HTTP; Tue, 14 Dec 2010 00:30:23 -0800 (PST) In-Reply-To: <1292288355561-3303905.post@n5.nabble.com> References: <1292288355561-3303905.post@n5.nabble.com> From: Claus Ibsen Date: Tue, 14 Dec 2010 09:30:23 +0100 Message-ID: Subject: Re: SFTP operation raises an exception, but the file is transferred To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 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: > > =A0 =A0 =A0 =A0 public static void main(String args[]) throws Exception { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// create CamelContext > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CamelContext context =3D new DefaultCamelC= ontext(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// add our route to the CamelContext > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0context.addRoutes(new RouteBuilder() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0@Override > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public void configure() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0from("sftp://@ server>/?password=3D").to("file:data/outbox"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// start the route and let it do its work > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0context.start(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Thread.sleep(50000); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// stop the CamelContext > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0context.stop(); > =A0 =A0 =A0 =A0 =A0 =A0} > > When i check the output folder, I see that the file is downloaded. But wh= en > the content is stopped, I see the following exception: > > SEVERE: Caused by: > [org.apache.camel.component.file.GenericFileOperationFailedException - > Cannot retrieve file: =A0data/input/Set1.txt] > org.apache.camel.component.file.GenericFileOperationFailedException: Cann= ot > retrieve file: data/input/Set1.txt > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStrea= mInBody(SftpOperations.java:482) > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOp= erations.java:448) > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.GenericFileConsumer.processExchange(Gener= icFileConsumer.java:299) > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericF= ileConsumer.java:155) > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsu= mer.java:121) > =A0 =A0 =A0 =A0at > org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.jav= a:97) > =A0 =A0 =A0 =A0at java.util.concurrent.Executors$RunnableAdapter.call(Exe= cutors.java:441) > =A0 =A0 =A0 =A0at > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317= ) > =A0 =A0 =A0 =A0at java.util.concurrent.FutureTask.runAndReset(FutureTask.= java:150) > =A0 =A0 =A0 =A0at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.acce= ss$101(ScheduledThreadPoolExecutor.java:98) > =A0 =A0 =A0 =A0at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runP= eriodic(ScheduledThreadPoolExecutor.java:180) > =A0 =A0 =A0 =A0at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(= ScheduledThreadPoolExecutor.java:204) > =A0 =A0 =A0 =A0at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor= .java:886) > =A0 =A0 =A0 =A0at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.jav= a:908) > =A0 =A0 =A0 =A0at java.lang.Thread.run(Thread.java:662) > Caused by: java.io.IOException: inputstream is closed > =A0 =A0 =A0 =A0at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2325) > =A0 =A0 =A0 =A0at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:234= 9) > =A0 =A0 =A0 =A0at com.jcraft.jsch.ChannelSftp.access$800(ChannelSftp.java= :36) > =A0 =A0 =A0 =A0at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:109= 2) > =A0 =A0 =A0 =A0at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:105= 2) > =A0 =A0 =A0 =A0at org.apache.camel.util.IOHelper.copy(IOHelper.java:104) > =A0 =A0 =A0 =A0at org.apache.camel.util.IOHelper.copy(IOHelper.java:86) > =A0 =A0 =A0 =A0at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelp= er.java:111) > =A0 =A0 =A0 =A0at > org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStrea= mInBody(SftpOperations.java:475) > =A0 =A0 =A0 =A0... 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 U= RI > 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-oper= ation-raises-an-exception-but-the-file-is-transferred-tp3303905p3303905.htm= l > Sent from the Camel - Users mailing list archive at Nabble.com. > --=20 Claus Ibsen ----------------- FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/