camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: GenericFileOperationFailedException - Cannot rename file
Date Fri, 04 Feb 2011 13:39:35 GMT
Hi

Can you post on the Camel user forum, when its related to help or
issues using Camel.

And try with Camel 2.6. Usually the issue on windows is that the file
stream is "locked" somewhere. And you need to close that before it can
rename the file. And sometimes its because windows is "slow" at
detecting this.



On Fri, Feb 4, 2011 at 2:07 PM, Nilesh Soni <nilsoni@gmail.com> wrote:
>  Hi,
>
> I am trying to read an XML file, split it and move it to an error folder in
> case there is any failure. for that purpose, I have changed some of the tags
> in my XML file so that SAXParser will throw an exception and hence camel
> will move the file into error folder. The problem is that camel is not
> writing the file to an error folder. Instead it throws an Exception stating
> cannot rename file. I have read in one post that this was a problem in camel
> earlier with Windows system but was resolved. Why i am still getting this
> error? My OS is Windows XP. Camel version is >= 2.5.0 For more detail, I am
> adding the code and log below.
>
> *Code*
>
> RouteDefinition routeDefinition = from("file:" + sourceEventFolder +
> "?noop=false&move=processing" + "&moveFailed=error") ;
> FilterDefinition filterDefinition =
> routeDefinition.filter().simple("${file:name.ext} contains 'event'") ;
> ExpressionNode process = filterDefinition.process(new Processor() {
>
> public void process(Exchange exchange) throws Exception {
>
> logger.debug("process() is called. ") ;
>
>  }
>
> }) ;
> XPathBuilder xpath = xpath("/EVENTS/EVENT") ;
> ExpressionNode splittedNode = filterDefinition.split(xpath) ;
> splittedNode.to("file:" + splittedEventWorkFolder +
> "?fileName=${file:name}-${date:now:yyyyMMdd-HHmmssSSS}-part-${in.header.id}")
> ;
>
> *Log*
>
> 2011-02-03 17:42:58,014 ERROR
> [org.apache.camel.component.file.GenericFileOnCompletion] -
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> rename file: GenericFile[Sample20110203-155258197EventFile.event] to:
> GenericFile[error\Sample20110203-155258197EventFile.event] at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)
> at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.rollback(GenericFileRenameProcessStrategy.java:65)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyRollback(GenericFileOnCompletion.java:164)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:94)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onFailure(GenericFileOnCompletion.java:57)
> at
> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
> at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:166)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:140)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:36)
> at
> org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:109)
> at org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:275)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
> 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:181)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> 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:619)
>
>
> Regards,
> Nilesh Soni
>
>
>
> --
> Nilesh Soni
>



-- 
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/

Mime
View raw message