Forum Home » Fuse Distributions » Fuse ESB

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

 

Permlink Replies: 5 - Last Post: Feb 9, 2011 8:55 AM Last Post By: davsclaus
robstoner

Posts: 2
Registered: 02/07/11
Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 7, 2011 10:16 PM
  Click to reply to this thread Reply
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:

<osgi:camelContext xmlns="http://camel.apache.org/schema/spring">

<route>
<from uri="ftp://test@localhost?password=test&amp;binary=true&amp;consumer.delay=30000"/>
<to uri="file://usr/local/test"/>
</route>

</osgi:camelContext>

I have the following features installed in Fuse 4.3.1:

karaf@root> features:list | grep -v uninstall
State Version Name Repository
installed http://5.4.2-fuse-01-00 activemq activemq-5.4.2-fuse-01-00
installed http://5.4.2-fuse-01-00 activemq-blueprint activemq-5.4.2-fuse-01-00
installed http://2.3.2-fuse-00-00 cxf repo-0
installed http://2011.01.0-fuse-00-00 servicemix-shared repo-0
installed http://2011.01.0-fuse-00-00 servicemix-cxf-bc repo-0
installed http://2011.01.0-fuse-00-00 servicemix-file repo-0
installed http://2011.01.0-fuse-00-00 servicemix-ftp repo-0
installed http://2011.01.0-fuse-00-00 servicemix-http repo-0
installed http://2011.01.0-fuse-00-00 servicemix-jms repo-0
installed http://2011.01.0-fuse-00-00 servicemix-mail repo-0
installed http://2011.01.0-fuse-00-00 servicemix-bean repo-0
installed http://2011.01.0-fuse-00-00 servicemix-camel repo-0
installed http://2011.01.0-fuse-00-00 servicemix-drools repo-0
installed http://2011.01.0-fuse-00-00 servicemix-cxf-se repo-0
installed http://2011.01.0-fuse-00-00 servicemix-eip repo-0
installed http://2011.01.0-fuse-00-00 servicemix-osworkflow repo-0
installed http://2011.01.0-fuse-00-00 servicemix-quartz repo-0
installed http://2011.01.0-fuse-00-00 servicemix-scripting repo-0
installed http://2011.01.0-fuse-00-00 servicemix-validation repo-0
installed http://2011.01.0-fuse-00-00 servicemix-saxon repo-0
installed http://2011.01.0-fuse-00-00 servicemix-wsn2005 repo-0
installed http://2011.01.0-fuse-00-00 servicemix-snmp repo-0
installed http://2011.01.0-fuse-00-00 servicemix-vfs repo-0
installed http://2011.01.0-fuse-00-00 servicemix-smpp repo-0
installed http://2011.01.0-fuse-00-00 servicemix-exec repo-0
installed http://4.3.1-fuse-00-00 activemq-broker repo-0
installed http://1.4.0-fuse-00-00 naming repo-0
installed http://0.2-incubating transaction repo-0
installed http://1.4.0-fuse-00-00 document repo-0
installed http://1.4.0-fuse-00-00 nmr repo-0
installed http://4.0.8 woodstox repo-0
installed http://1.4.0-fuse-00-00 jbi repo-0
installed http://1.4.0-fuse-00-00 jbi-cluster repo-0
installed http://3.0.5.RELEASE spring karaf-2.1.3-fuse-00-00
installed http://1.2.0 spring-dm karaf-2.1.3-fuse-00-00
installed http://2.1.3-fuse-00-00 config karaf-2.1.3-fuse-00-00
installed http://2.1.3-fuse-00-00 http karaf-2.1.3-fuse-00-00
installed http://2.1.3-fuse-00-00 war karaf-2.1.3-fuse-00-00
installed http://2.6.0-fuse-00-00 camel-core repo-0
installed http://2.6.0-fuse-00-00 camel-spring repo-0
installed http://2.6.0-fuse-00-00 camel-blueprint repo-0
installed http://2.6.0-fuse-00-00 camel-ftp repo-0
installed http://2.6.0-fuse-00-00 camel-spring-integration repo-0

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

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
<version>2.6.0</version>
<!-- use the same version as your Camel core version -->
</dependency>

I am using Maven 2.2.1 to install and build the project. I also have the Maven plug in for Eclipse.

Like I mentioned earlier, "file to file" works, but when I change it to "ftp to file", I get this stack trace:

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: 223
karaf@root> 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.)

davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 8, 2011 10:26 AM   in response to: robstoner in response to: robstoner
  Click to reply to this thread Reply
Can you try stopping the server. clear the data folder. And start server again.
gertv

Posts: 167
Registered: 06/18/08
Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 8, 2011 12:20 PM   in response to: robstoner in response to: robstoner
  Click to reply to this thread Reply
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&#38;noop=true"/>
      <log message="Processing ${file:name}"/>
    </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

robstoner

Posts: 2
Registered: 02/07/11
Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 8, 2011 4:33 PM   in response to: robstoner in response to: robstoner
  Click to reply to this thread Reply
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

gertv

Posts: 167
Registered: 06/18/08
Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 8, 2011 9:35 PM   in response to: robstoner in response to: robstoner
  Click to reply to this thread Reply
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

davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Camel 2.5/2.6 - FTP Endpoint not working on ESB 4.3.0/4.3.1
Posted: Feb 9, 2011 8:55 AM   in response to: gertv in response to: gertv
  Click to reply to this thread Reply
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.