You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pevgen <pe...@km.ru> on 2009/02/12 18:38:08 UTC

File component : file don't move

Hello.

sometimes, but not each time, I got Exceptions :
 
org.apache.camel.component.file.FileComponent@37165f] ERROR
org.apache.camel.component.file.FileConsumer  - Can not rename file from:
C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt
java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt to:
C:\Temp\amqtest\in\.camel\1.txt
	at
org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69)
....


and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory, and
a file '1.txt.camelLock' didn't delete from the directory, too.

i try to use the route :

<route errorHandlerRef="deadLetterErrorHandlerInfinity">
            <from uri="file://C:\Temp\amqtest\in"/>            
            <to ref="activemq:queue:myq1"/>
</route>

and i use 'JmsTransactionManager'. I say about this, because when i don't
use the 'JmsTransactionManager',  it seems that i haven't got this error.

any suggests ?

Thanks.
Evgeny
-- 
View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21980942.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File component : file don't move

Posted by pevgen <pe...@km.ru>.
I found a strange decision of the problem.
There are string messages in my files, and i can append '<convertBodyTo
type="java.lang.String"/>' after <from uri="file.....">. In this case the
route work.

Evgeny



pevgen wrote:
> 
> Hello.
> 
> sometimes, but not each time, I got Exceptions :
>  
> org.apache.camel.component.file.FileComponent@37165f] ERROR
> org.apache.camel.component.file.FileConsumer  - Can not rename file from:
> C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt
> java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt
> to: C:\Temp\amqtest\in\.camel\1.txt
> 	at
> org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69)
> ....
> 
> 
> and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory,
> and a file '1.txt.camelLock' didn't delete from the directory, too.
> 
> i try to use the route :
> 
> <route errorHandlerRef="deadLetterErrorHandlerInfinity">
>             <from uri="file://C:\Temp\amqtest\in"/>            
>             <to ref="activemq:queue:myq1"/>
> </route>
> 
> and i use 'JmsTransactionManager'. I say about this, because when i don't
> use the 'JmsTransactionManager',  it seems that i haven't got this error.
> 
> any suggests ?
> 
> Thanks.
> Evgeny
> 

-- 
View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21993292.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File component : file don't move

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?

Does this error happens all the time with the JMS TX manager?

Do you mind creating a small sample as a .zip file, then I would like
to take a look.?

The Java IO API in Java is quite terrible when it comes to error
information as the rename operations just return true/false.
So its not possible to know the real cause.

We have to wait for NIO2 in Java 7 for this to be fixed.

Maybe the TX is holding on some stream/object. You can try adding a
little delayer at the end
> <route errorHandlerRef="deadLetterErrorHandlerInfinity">
>            <from uri="file://C:\Temp\amqtest\in"/>
>            <to ref="activemq:queue:myq1"/>

<delayer>
  <delayTime>3000</delayTime>
  </expression>
</delayer>

> </route>

See
http://camel.apache.org/delayer.html




On Thu, Feb 12, 2009 at 6:38 PM, pevgen <pe...@km.ru> wrote:
>
> Hello.
>
> sometimes, but not each time, I got Exceptions :
>
> org.apache.camel.component.file.FileComponent@37165f] ERROR
> org.apache.camel.component.file.FileConsumer  - Can not rename file from:
> C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt
> java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt to:
> C:\Temp\amqtest\in\.camel\1.txt
>        at
> org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69)
> ....
>
>
> and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory, and
> a file '1.txt.camelLock' didn't delete from the directory, too.
>
> i try to use the route :
>
> <route errorHandlerRef="deadLetterErrorHandlerInfinity">
>            <from uri="file://C:\Temp\amqtest\in"/>
>            <to ref="activemq:queue:myq1"/>
> </route>
>
> and i use 'JmsTransactionManager'. I say about this, because when i don't
> use the 'JmsTransactionManager',  it seems that i haven't got this error.
>
> any suggests ?
>
> Thanks.
> Evgeny
> --
> View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21980942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: File component : file don't move

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Feb 13, 2009 at 10:53 AM, pevgen <pe...@km.ru> wrote:
>
> I found a strange decision of the problem.
> There are string messages in my files, and i can append '<convertBodyTo
> type="java.lang.String"/>' after <from uri="file.....">. In this case the
> route work. and in-files move to backup directory.
Hi

1)
Thanks for sharing this. Without the convert Camel will use the File
handle as body and the JMS producer
will send the JMS as a byte message.

2)
When you do convert body to String you read the content and store it
as plain String on the Exchanage.
Then the JMS producer will just use the String and set a TextMessage.

So there could be a byte stream not being closed, in situation #1.



>
> Evgeny
>
>
>
> pevgen wrote:
>>
>> Hello.
>>
>> sometimes, but not each time, I got Exceptions :
>>
>> org.apache.camel.component.file.FileComponent@37165f] ERROR
>> org.apache.camel.component.file.FileConsumer  - Can not rename file from:
>> C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt
>> java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt
>> to: C:\Temp\amqtest\in\.camel\1.txt
>>       at
>> org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69)
>> ....
>>
>>
>> and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory,
>> and a file '1.txt.camelLock' didn't delete from the directory, too.
>>
>> i try to use the route :
>>
>> <route errorHandlerRef="deadLetterErrorHandlerInfinity">
>>             <from uri="file://C:\Temp\amqtest\in"/>
>>             <to ref="activemq:queue:myq1"/>
>> </route>
>>
>> and i use 'JmsTransactionManager'. I say about this, because when i don't
>> use the 'JmsTransactionManager',  it seems that i haven't got this error.
>>
>> any suggests ?
>>
>> Thanks.
>> Evgeny
>>
>
> --
> View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21993317.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: File component : file don't move

Posted by pevgen <pe...@km.ru>.
I found a strange decision of the problem.
There are string messages in my files, and i can append '<convertBodyTo
type="java.lang.String"/>' after <from uri="file.....">. In this case the
route work. and in-files move to backup directory.

Evgeny



pevgen wrote:
> 
> Hello.
> 
> sometimes, but not each time, I got Exceptions :
>  
> org.apache.camel.component.file.FileComponent@37165f] ERROR
> org.apache.camel.component.file.FileConsumer  - Can not rename file from:
> C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt
> java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt
> to: C:\Temp\amqtest\in\.camel\1.txt
> 	at
> org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69)
> ....
> 
> 
> and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory,
> and a file '1.txt.camelLock' didn't delete from the directory, too.
> 
> i try to use the route :
> 
> <route errorHandlerRef="deadLetterErrorHandlerInfinity">
>             <from uri="file://C:\Temp\amqtest\in"/>            
>             <to ref="activemq:queue:myq1"/>
> </route>
> 
> and i use 'JmsTransactionManager'. I say about this, because when i don't
> use the 'JmsTransactionManager',  it seems that i haven't got this error.
> 
> any suggests ?
> 
> Thanks.
> Evgeny
> 

-- 
View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21993317.html
Sent from the Camel - Users mailing list archive at Nabble.com.