Hi

The SFTP library is returning an exception with status code 3. You may
dig around what that means.

When this problem occurs, does the same problem occur on next poll?
The ftp component have build in self healing, but that is limited to
the ftp connection/session.
So in case there is something wrong with the session it re login automatic.

Also you can use readLock=none as uri parameter to not use locks at
all. You can do this if you do not have a race condition
where another party is writing a new file, which you then want to download.

Its actually best to let the other party write to another directory
and then when the file is complete, move it in place.
Or write using a temporary filename, and then rename when write is complete.



On Thu, Apr 15, 2010 at 1:37 PM, watcher <patr...@daly.ws> wrote:
>
> Apache Camel 2.2
> Windows Server 2003
>
> I'm running an application that polls an SFTP server. I works to a point but
> after some time the applications fails trying to get an exclusive lock on
> the file. Whick seems to indicate that it is a permission problem. However
> restarting the application (camel) fixes the issue. Could it be a fault with
> camel?
>
> [code]
>
> <camel:camelContext xmlns="http://camel.apache.org/schema/spring";>
>  <camel:routeBuilder ref="myRouter"/>
>        <camel:endpoint id="printerIncoming"
> uri="sftp://${printerincomi...@${ipaddress}?password=password&amp;binary=true&amp;recursive=true&amp;delay=10000&amp;initialDelay=2000&amp;move=.done&amp;knownHostsFile=c://known_host&amp;filter=#myAntFilter"/>
> </camel:camelContext>
>
>
>        <!-- we use the AntPathMatcherRemoteFileFilter to use ant paths for
> includes and exlucde -->
>        <bean id="myAntFilter"
> class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter">
>            <property name="includes" 
> value="**/incoming/*.PDF,**/incoming/*.pdf"/>
>            <property name="excludes" value="**/outgoing/**"/>
>
>        </bean>
> [/code]
>
> [code]
> 15 Apr 2010 10:17:57,077 ERROR [Camel thread 0: SftpComponent]
> SftpConsumer.log(248) | Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot rename file from: user/incoming/test_file.pdf to:
> test_file.pdf.camelExclusiveReadLock]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> rename file from: user/incoming/test_file.pdf to:
> test_file.pdf.camelExclusiveReadLock
>        at
> org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:205)
>        at
> org.apache.camel.component.file.strategy.GenericFileRenameExclusiveReadLockStrategy.acquireExclusiveReadLock(GenericFileRenameExclusiveReadLockStrategy.java:68)
>        at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:44)
>        at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:38)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:221)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:137)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:103)
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:106)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown 
> Source)
>        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
> Source)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
> Source)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
> Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
> Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)
> Caused by: 3:
>        at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2287)
>        at com.jcraft.jsch.ChannelSftp.rename(ChannelSftp.java:1479)
>        at
> org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:202)
>        ... 16 more
> [/code]
> --
> View this message in context: 
> http://old.nabble.com/SFTP-rename-problems-tp28254146p28254146.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to