5 Replies Latest reply on Feb 9, 2011 3:55 AM by davsclaus

    Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1

    robstoner

      Hi all,

       

      I am trying to run the camel-example-osgi sample (for both Camel 2.5 and 2.6).  It runs with a "timer", "log", "bean" or "file" endpoint, but when I change the endpoint to "ftp", and install the bundle, it immediately dumps out a type not present exception. 

       

      Sample Code:

       

         features:list | grep -v uninstall

      State         Version                Name                                 Repository

      activemq                             activemq-5.4.2-fuse-01-00

      activemq-blueprint                   activemq-5.4.2-fuse-01-00

      cxf                                  repo-0

      servicemix-shared                    repo-0

      servicemix-cxf-bc                    repo-0

      servicemix-file                      repo-0

      servicemix-ftp                       repo-0

      servicemix-http                      repo-0

      servicemix-jms                       repo-0

      servicemix-mail                      repo-0

      servicemix-bean                      repo-0

      servicemix-camel                     repo-0

      servicemix-drools                    repo-0

      servicemix-cxf-se                    repo-0

      servicemix-eip                       repo-0

      servicemix-osworkflow                repo-0

      servicemix-quartz                    repo-0

      servicemix-scripting                 repo-0

      servicemix-validation                repo-0

      servicemix-saxon                     repo-0

      servicemix-wsn2005                   repo-0

      servicemix-snmp                      repo-0

      servicemix-vfs                       repo-0

      servicemix-smpp                      repo-0

      servicemix-exec                      repo-0

      activemq-broker                      repo-0

      naming                               repo-0

      transaction                          repo-0

      document                             repo-0

      nmr                                  repo-0

      woodstox                             repo-0

      jbi                                  repo-0

      jbi-cluster                          repo-0

      spring                               karaf-2.1.3-fuse-00-00

      spring-dm                            karaf-2.1.3-fuse-00-00

      config                               karaf-2.1.3-fuse-00-00

      http                                 karaf-2.1.3-fuse-00-00

      war                                  karaf-2.1.3-fuse-00-00

      camel-core                           repo-0

      camel-spring                         repo-0

      camel-blueprint                      repo-0

      camel-ftp                            repo-0

      camel-spring-integration             repo-0

       

       

      And have added the follow dependency to my camel-example-osgi POM.xml:

       

                 Exception in thread "SpringOsgiExtenderThread-18" org.apache.camel.RuntimeCamelException: java.lang.TypeNotPresentException: Typ

      e org.apache.camel.component.file.strategy.GenericFileProcessStrategyFactory class not found not present

              at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)

              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)

              at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237)

              at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

              at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)

              at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)

              at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.

      java:235)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplication

      Context.java:358)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionA

      pplicationContext.java:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.ru

      n(DependencyWaiterApplicationContextExecutor.java:136)

              at java.lang.Thread.run(Thread.java:619)

      Caused by: java.lang.TypeNotPresentException: Type org.apache.camel.component.file.strategy.GenericFileProcessStrategyFactory class not foun

      d not present

              at org.apache.camel.component.file.GenericFileEndpoint.createGenericFileStrategy(GenericFileEndpoint.java:157)

              at org.apache.camel.component.file.GenericFileEndpoint.getGenericFileProcessStrategy(GenericFileEndpoint.java:126)

              at org.apache.camel.component.file.GenericFileConsumer.doStart(GenericFileConsumer.java:488)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)

              at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)

              at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1593)

              at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1859)

              at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1812)

              at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1738)

              at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1528)

              at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1420)

              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)

              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)

              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)

              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)

              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)

              ... 10 more

       

      Any suggestions would be appreciated,

       

      Thanks,

       

      Rob

       

      (PS, in Camel 2.2 and 2.3, this application builds and runs with a local FTP server, however does not retrieve files from the remote server I am making a request to.  The stepwise functionality from 2.6 would be nice to have.)

        • 1. Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
          davsclaus

          Can you try stopping the server. clear the data folder. And start server again.

          • 2. Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
            gertv

            L.S.,

             

             

            Could you paste the full Spring XML configuration file you're using?  I have just tried this locally with 4.3.1-fuse-00-00 and the file below seems to work fine on my machine:

             

            <beans xmlns="http://www.springframework.org/schema/beans"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:camel="http://camel.apache.org/schema/spring"
                   xsi:schemaLocation="
                      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                      http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
            
              <camelContext xmlns="http://camel.apache.org/schema/spring">
                <route>
                  <from uri="ftp://gert@localhost?password=ietsanders&noop=true"></from>
                  <log message="Processing ${file:name}"></log>
                </route>
              </camelContext>
            
            </beans>   
            

             

             

            Regards,

             

            Gert

             

             

            P.S. Feel free to replace '&#38;' with '&amp;' - substitution happened automatically when I copy-pasted this in here

             

            Edited by: gertv on Feb 8, 2011 1:20 PM

            • 3. Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
              robstoner

              Thanks for the responses.  After stopping the server, clearing out the data directory, starting the server and running Gert's code as posted, I get this exception:

               

               

              karaf@root> osgi:install -s file:C:/apache-camel-2.6.0/examples/camel-example-osgi/target/camel-example-osgi-2.6.0.jar

              Bundle ID: 198

              karaf@root> Exception in thread "SpringOsgiExtenderThread-6" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteExc

              eption: Failed to create route route1: Route[[From[ftp://gert@localhost?password=ietsanders&noop=tr... because of Failed to resolve endpoint

              : ftp://gert@localhost?noop=true&password=ietsanders due to: No component found with scheme: ftp

                      at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)

                      at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)

                      at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237)

                      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

                      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)

                      at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)

                      at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.

              java:235)

                      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplication

              Context.java:358)

                      at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionA

              pplicationContext.java:320)

                      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.ru

              n(DependencyWaiterApplicationContextExecutor.java:136)

                      at java.lang.Thread.run(Thread.java:619)

              Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route[[From[ftp://gert@localhost?password=ietsander

              s&noop=tr... because of Failed to resolve endpoint: ftp://gert@localhost?noop=true&password=ietsanders due to: No component found with schem

              e: ftp

                      at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)

                      at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:701)

                      at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1623)

                      at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1412)

                      at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)

                      at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)

                      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)

                      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)

                      at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)

                      at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)

                      at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)

                      ... 10 more

              Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: ftp://gert@localhost?noop=true&password=ietsanders d

              ue to: No component found with scheme: ftp

                      at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:456)

                      at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:47)

                      at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:175)

                      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:737)

                      at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:160)

                      ... 20 more

               

              Which is slightly different. 

               

              All features, including camel-ftp installed without error before running this sample. 

               

              Any ideas?

               

              thanks,

               

              Rob

              • 4. Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
                gertv

                L.S.,

                 

                 

                I was able to reproduce this using OSGi bundle packaging instead of deploying a plain Spring XML file as I was doing before and then got things working again with a little hack to the MANIFEST.MF information.

                 

                If you add either one of these, it works fine on my machine:

                - a Require-Bundle for org.apache.camel.camel-core and org.apache.camel.camel-ftp

                - an Import-Package for the missing type reported in the original exception (org.apache.camel.component.file.strategy)

                 

                The reason this works fine with the plain Spring XML approach is because that comes with a DynamicImport-Package=* to allow things to get wired to any package in the system.

                 

                Anyway, we also want to get this working out-of-the-box again without any additional MANIFEST tinkering, so I raised http://fusesource.com/issues/browse/MR-420 to ensure we don't forget to look into this.

                 

                 

                Thanks for taking the time to report this,

                 

                Gert

                • 5. Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
                  davsclaus

                  I have attached a patched JAR to the ticket

                  http://fusesource.com/issues/browse/MR-420

                   

                  You can override this JAR file in the system/org/apache/camel/camel-ftp ... directory.

                   

                  You would need to stop the server.

                  Override the JAR

                  And start the server again.

                   

                  Pay attention if you reinstall the server/camel-ftp feature it may re-download the original JAR, which mean you would have to patch the JAR again.