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: Transfer files from ftp to local directory
Date Thu, 22 Nov 2012 14:24:13 GMT
Hi

You are almost the correct place. You should in the future use the
@user mailing list as we say
http://camel.apache.org/support

Your error tells you that it cannot create the FTP component, and the
reason is that the camel-ftp JAR is not on your classpath.
And mind that camel-ftp JAR has child dependencies you need to add as
JARs as well, such as commons-net etc.

If you use Maven that would happen automatic. If not you would need to
download these JARs and add manually.


On Thu, Nov 22, 2012 at 3:03 PM, tamil13 <tamilvanan101@gmail.com> wrote:
> Hi. I need to make one project which include transfer file from ftp to local
> directory .  I tried following code
>
>         public static void main(String[] args) throws Exception{
>                 CamelContext context = new DefaultCamelContext();
>                 context.addRoutes(new RouteBuilder() {
>                 public void configure() {
>                                 from("ftp://192.168.2.46/workin?noop=true").to("file:outbox");
>
>         }
>                 });
>                 context.start();
>                 Thread.sleep(10000);
>                 context.stop();
>                 }
>
> I received following exceptions
>
> 250 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.8.1 (CamelContext: camel-1) is starting
> 250 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
> Using ManagedManagementStrategy.
> 328 [main] WARN org.apache.camel.impl.DefaultCamelContext - Cannot find
> needed classes for JMX lifecycle strategy. Needed class is in
> spring-context.jar using Spring 2.5 or newer (spring-jmx.jar using Spring
> 2.0.x). NoClassDefFoundError:
> org/springframework/jmx/export/metadata/JmxAttributeSource
> 328 [main] WARN org.apache.camel.impl.DefaultCamelContext - Cannot use JMX.
> Fallback to using DefaultManagementStrategy (non JMX).
> 344 [main] INFO
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 3
> packages with 15 @Converter classes to load
> 422 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
> Loaded 154 core type converters (total 154 type converters)
> 422 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
> Loaded additional 0 type converters (total 154 type converters) in 0.000
> seconds
> 437 [main] WARN org.apache.camel.util.ObjectHelper - Cannot find class:
> org.apache.camel.component.file.remote.FtpComponent
> 437 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.8.1 (CamelContext:camel-1) is shutting down
> 437 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Starting to
> graceful shutdown 0 routes (timeout 300 seconds)
> 453 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Graceful
> shutdown of 0 routes completed in 0 seconds
> 453 [main] INFO org.apache.camel.impl.DefaultInflightRepository - Shutting
> down with no inflight exchanges.
> 453 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime: 0.203
> seconds
> 453 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.8.1 (CamelContext: camel-1) is shutdown in 0.016 seconds
> Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
> Failed to create route route1:
> Route[[From[ftp://localhost/workin?noop=true]] -> [Idempoten... because of
> Failed to resolve endpoint: ftp://localhost/workin?noop=true due to: Cannot
> auto create component: ftp
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)
>         at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:697)
>         at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1651)
>         at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1440)
>         at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)
>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>         at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)
>         at FTP.main(FTP.java:27)
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
> resolve endpoint: ftp://localhost/workin?noop=true due to: Cannot auto
> create component: ftp
>         at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:443)
>         at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)
>         at
> org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)
>         at
> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)
>         at
> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
>         at
> org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
>         at
> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:772)
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
>         ... 8 more
> Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create
> component: ftp
>         at
> org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:301)
>         at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:420)
>         ... 16 more
> Caused by: java.lang.IllegalArgumentException: Invalid URI, no Component
> registered for scheme: ftp
>         at
> org.apache.camel.impl.DefaultComponentResolver.resolveComponent(DefaultComponentResolver.java:79)
>         at
> org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:292)
>         ... 17 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.camel.component.file.remote.FtpComponent
>         at
> org.apache.camel.impl.DefaultFactoryFinder.newInstance(DefaultFactoryFinder.java:124)
>         at
> org.apache.camel.impl.DefaultFactoryFinder.findClass(DefaultFactoryFinder.java:77)
>         at
> org.apache.camel.impl.DefaultFactoryFinder.findClass(DefaultFactoryFinder.java:69)
>         at
> org.apache.camel.impl.DefaultComponentResolver.findComponent(DefaultComponentResolver.java:98)
>         at
> org.apache.camel.impl.DefaultComponentResolver.resolveComponent(DefaultComponentResolver.java:71)
>         ... 18 more
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transfer-files-from-ftp-to-local-directory-tp5723118.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message