[
https://issues.apache.org/jira/browse/CAMEL-5774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-5774.
--------------------------------
Resolution: Fixed
Viktor, thanks for reporting.
And Thomas for the hint for the solution.
But there was other problems on the receiver side when using
transferExchange=true and with files. So this is not supported any longer.
> ActiveMQ target endpoint with transferExchange=true does not work together
> with source File endpoint with preMove option set
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5774
> URL: https://issues.apache.org/jira/browse/CAMEL-5774
> Project: Camel
> Issue Type: Bug
> Components: camel-activemq, camel-core, camel-jms
> Affects Versions: 2.10.2
> Reporter: Viktor Nikolenko
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.10.4, 2.11.0
>
>
> Got failure on a simple route reading from file and sending to ActiveMQ queue.
> On source File endpoint set preMove option to some folder, and on target
> activemq endpoint set transferExchange=true.
> It fails with FileNotFound exception, trying to read file from original
> location, not from temporary preMoved one.
> Without preMove all works perfect.
> Simplified Spring application context with Camel routes looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> <bean id="brokerService" class="org.apache.activemq.broker.BrokerService"
> init-method="start" destroy-method="stop">
> <property name="brokerName" value="localhost" />
> <property name="useJmx" value="false" />
> <property name="transportConnectorURIs">
> <list>
> <value>vm://localhost</value>
> </list>
> </property>
> </bean>
>
> <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory"
> depends-on="brokerService">
> <property name="brokerURL" value="vm://localhost"/>
> <property name="redeliveryPolicy"
> ref="redeliveryPolicyConfigActiveMQ"/>
> </bean>
>
> <bean id="pooledConnectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start"
> destroy-method="stop">
> <property name="maxConnections" value="8" />
> <property name="maximumActive" value="500" />
> <property name="connectionFactory" ref="jmsConnectionFactory" />
> </bean>
>
> <bean id="redeliveryPolicyConfigActiveMQ"
> class="org.apache.activemq.RedeliveryPolicy">
> <property name="maximumRedeliveries" value="1"/>
> <property name="redeliveryDelay" value="5000"/>
> </bean>
>
>
> <camelContext id="testCustomer"
> xmlns="http://camel.apache.org/schema/spring">
>
> <endpoint id="sourceEndpoint"
> uri="file:e:/work/ids/testCustomer/input/?preMove=.tmp&delay=1000&readLock=rename&copyAndDeleteOnRenameFail=false&move=.archive&moveFailed=.failed"
> />
> <endpoint id="destJms"
> uri="activemq:queue:source?transferExchange=true&connectionFactory=#pooledConnectionFactory"
> />
> <route id="testRoute">
> <from ref="sourceEndpoint" />
> <to ref="destJms" />
> </route>
> </camelContext>
> </beans>
> Exception trace:
> org.apache.camel.TypeConversionException: Error during type conversion from
> type: java.io.File to the required type: byte[] with value
> e:\work\ids\testCustomer\input\payment.xml due java.io.FileNotFoundException:
> e:\work\ids\testCustomer\input\payment.xml (The system cannot find the file
> specified)
> at
> com.it.ids.exceptions.HandleException.process(HandleException.java:20)
> at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.FatalFallbackErrorHandler.processNext(FatalFallbackErrorHandler.java:42)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.deliverToFailureProcessor(RedeliveryErrorHandler.java:766)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:273)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
> at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336)
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)
> at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)
> at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
> 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: org.apache.camel.RuntimeCamelException:
> java.io.FileNotFoundException: e:\work\ids\testCustomer\input\payment.xml
> (The system cannot find the file specified)
> at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1270)
> at
> org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:926)
> at
> org.apache.camel.impl.converter.StaticMethodTypeConverter.convertTo(StaticMethodTypeConverter.java:47)
> at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:253)
> at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:155)
> at
> org.apache.camel.component.file.FileBinding.loadContent(FileBinding.java:57)
> at
> org.apache.camel.component.file.GenericFileConverter.genericFileToInputStream(GenericFileConverter.java:123)
> at
> org.apache.camel.component.file.GenericFileConverter.genericFileToSerializable(GenericFileConverter.java:152)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:922)
> at
> org.apache.camel.impl.converter.StaticMethodTypeConverter.convertTo(StaticMethodTypeConverter.java:47)
> at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:253)
> at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:111)
> at
> org.apache.camel.impl.DefaultExchangeHolder.checkMapSerializableObjects(DefaultExchangeHolder.java:209)
> at
> org.apache.camel.impl.DefaultExchangeHolder.safeSetProperties(DefaultExchangeHolder.java:177)
> at
> org.apache.camel.impl.DefaultExchangeHolder.marshal(DefaultExchangeHolder.java:93)
> at
> org.apache.camel.impl.DefaultExchangeHolder.marshal(DefaultExchangeHolder.java:71)
> at
> org.apache.camel.component.jms.JmsBinding.createJmsMessage(JmsBinding.java:439)
> at
> org.apache.camel.component.jms.JmsBinding.makeJmsMessage(JmsBinding.java:287)
> at
> org.apache.camel.component.jms.JmsProducer$2.createMessage(JmsProducer.java:266)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:215)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:158)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$3.doInJms(JmsConfiguration.java:192)
> at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:189)
> at
> org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:398)
> at
> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:352)
> at
> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:132)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
> at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:334)
> ... 28 more
> Caused by: java.io.FileNotFoundException:
> e:\work\ids\testCustomer\input\payment.xml (The system cannot find the file
> specified)
> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(FileInputStream.java:106)
> at
> org.apache.camel.converter.IOConverter.toInputStream(IOConverter.java:73)
> at
> org.apache.camel.converter.IOConverter.toByteArray(IOConverter.java:243)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:922)
> ... 71 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira