You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Kevin Fightmaster <kf...@gmail.com> on 2010/04/19 17:36:18 UTC
Error Copying a file from one directory to another
I'm trying to get a simple example up in working with files:
ContextFile 1
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:broker="http://activemq.apache.org/schema/core"
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-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<context:component-scan base-package="com.ngc.iaep.services" />
<!-- CAMEL CONTEXT DECLARATION -->
<camel:camelContext id="camel">
<camel:jmxAgent id="agent" createConnector="true" />
</camel:camelContext>
<!-- EMBEDDED ACTIVEMQ PROCESS -->
<broker:broker useJmx="false" persistent="false" brokerName="localhost">
<broker:transportConnectors>
<broker:transportConnector name="tcp" uri="tcp://localhost:61610" />
</broker:transportConnectors>
</broker:broker>
<!-- MESSAGE BEAN -->
<bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://localhost:61610" />
</bean>
</beans>
Context File 2
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://camel.apache.org/schema/spring"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- CAMEL CONTEXT -->
<camelContext id="camel">
<!-- ROUTES -->
<route>
<from uri="jms:queue:twittersearch" />
<to uri="bean:twittercollector" />
</route>
<!-- route>
<from uri="jms:queue:twittertransformation" />
<to uri="xslt:twitter.xsl"/>
<to uri="jms:queue:documenthandler"/>
</route -->
<route>
<from
uri="file://project_feedoutput/?recursive=true&delete=true"/>
<!-- to uri="xslt:twitter.xsl"/ -->
<to uri="file://project_transformed/"/>
</route>
</camelContext>
</beans:beans>
I execute the test within eclipse using the following commands (which works
on other tests I've run)
camel:run
My maven pom has the plugin defined as:
...
<build>
<plugins>
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<fileApplicationContextUri>classpath*:*consumer.xml;classpath*:camelroutes.xml</fileApplicationContextUri>
</configuration>
</plugin>
</plugins>
</build>
...
I get the following Exception:
ERROR [Camel thread 0: FileComponent] (Logger.java:248) - Failed delivery
for exchangeId: 56e483d4-e2a4-4ebf-b21a-fa554c9ade74. Exhausted after
delivery attempt: 1 caught:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: project_transformed\twitter_results.xml
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: project_transformed\twitter_results.xml
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:211)
at
org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:195)
at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
at
org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:258)
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(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)
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: java.io.InputStream but has value: GenericFile[twitter_results.xml] of
type: org.apache.camel.component.file.GenericFile on: Message:
GenericFile[twitter_results.xml]. Caused by: No type converter available to
convert from type: org.apache.camel.component.file.GenericFile to the
required type: java.io.InputStream with value
GenericFile[twitter_results.xml]. Exchange[Message:
GenericFile[twitter_results.xml]]. Caused by:
[org.apache.camel.NoTypeConversionAvailableException - No type converter
available to convert from type: org.apache.camel.component.file.GenericFile
to the required type: java.io.InputStream with value
GenericFile[twitter_results.xml]]
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:103)
at
org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:116)
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:203)
... 34 more
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
org.apache.camel.component.file.GenericFile to the required type:
java.io.InputStream with value GenericFile[twitter_results.xml]
at
org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:123)
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
... 36 more
ERROR [Camel thread 0: FileComponent] (Logger.java:248) - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Cannot store file: project_transformed\twitter_results.xml]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: project_transformed\twitter_results.xml
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:211)
at
org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:195)
at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
at
org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:258)
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(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)
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: java.io.InputStream but has value: GenericFile[twitter_results.xml] of
type: org.apache.camel.component.file.GenericFile on: Message:
GenericFile[twitter_results.xml]. Caused by: No type converter available to
convert from type: org.apache.camel.component.file.GenericFile to the
required type: java.io.InputStream with value
GenericFile[twitter_results.xml]. Exchange[Message:
GenericFile[twitter_results.xml]]. Caused by:
[org.apache.camel.NoTypeConversionAvailableException - No type converter
available to convert from type: org.apache.camel.component.file.GenericFile
to the required type: java.io.InputStream with value
GenericFile[twitter_results.xml]]
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:103)
at
org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:116)
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:203)
... 34 more
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
org.apache.camel.component.file.GenericFile to the required type:
java.io.InputStream with value GenericFile[twitter_results.xml]
at
org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:123)
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
... 36 more
--
View this message in context: http://old.nabble.com/Error-Copying-a-file-from-one-directory-to-another-tp28287699p28287699.html
Sent from the Camel - Users mailing list archive at Nabble.com.