On 8/10/07, Aaron Crickenberger <[EMAIL PROTECTED]> wrote:
> I'm trying to use Camel to poll an incoming directory for files, and
> then FTP them elsewhere.  I started with camel-example-spring, added
> camel-ftp as a dependency, and modified MyRouteBuilder to look like so:
>
> public class MyRouteBuilder extends RouteBuilder {
>     public void configure() {
>
> from("file:/tmp/test/incoming/").to("ftp://[EMAIL 
> PROTECTED]:2021/?password=admin");
>     }
> }
>
> Putting a file in the "incoming" directory gives the following stack trace:
>
> SEVERE: On delivery attempt: 0 caught: java.lang.ClassCastException:
> org.apache.camel.component.file.remote.RemoteFileExchange
> java.lang.ClassCastException:
> org.apache.camel.component.file.remote.RemoteFileExchange
>         at
> org.apache.camel.component.file.FileMessage.getExchange(FileMessage.java:47)
>         at
> org.apache.camel.component.file.FileMessage.getExchange(FileMessage.java:29)
>         at
> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:48)
>         at
> org.apache.camel.component.file.remote.FtpProducer.process(FtpProducer.java:42)
>         at
> org.apache.camel.component.file.remote.FtpProducer.process(FtpProducer.java:37)
>         at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:65)
>         at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:78)
>         at
> org.apache.camel.component.file.FileConsumer.pollFile(FileConsumer.java:81)
>         at
> org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:51)
>         at
> org.apache.camel.component.file.FileConsumer.poll(FileConsumer.java:45)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:63)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
>         at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:613)
>
> Most of the other Producers appear to work fine with plain ol'
> Exchanges.  I tried modifying FtpProducer to do the same, and things
> started working.  Great!  However, I'm concerned this fixes the symptom,
> and not the underlying problem.
>
> Neither FtpProducer, SftpProducer nor FileProducer appear to really need
> their specific Exchanges (unit tests still pass anyway.)  However I
> suspect CxfProducer and CxfInvokerProducer might exhibit the "deeper"
> problem if I look further.  Thoughts?

Another great catch Aaron! I raised a JIRA for this to track the
release it ends up in...
https://issues.apache.org/activemq/browse/CAMEL-98

it turned out to be a bit of a gremlin in the camel-core for how we
copy exchanges (we were mixing FileMessage inside RemoteFileExchange
which caused some gremlins).

I've added a test case and this one seems fixed now in trunk...
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java

-- 
James
-------
http://macstrac.blogspot.com/

Reply via email to