Re: Problem using camel in osgi
Yes, all the magic thing happens when the OsgiDefaultCamelContext gets the reference of BundleContext. There are CamelContextFactoryBean, CamelContextFactory in the camel-osgi module you may use if you want to create a CamelContext in a OSGi platform. Willem Christian Schneider wrote: Seems the OsgiDefaultCamelContext does the trick. I will take a look into the source to understand what it is doing. Greetings Christian Am 22.05.2010 16:55, schrieb Christian Schneider: Hi Guillaume, as I import by bundle not package I think that I should have all TypeConverters available. The problem seems to be that they are not registered. Do you know how the registration of converters works in camel when running in osgi? Greetings Christian Am 22.05.2010 16:26, schrieb Guillaume Nodet: You may want to try using the osgi specific camel context instead, else you need to have all the components and converters available in your bundle classloader using imported package. On Saturday, May 22, 2010, Christian Schneiderch...@die-schneider.net wrote: Hi all, I am trying to get camel working in osgi. I wrote a simple bundle that starts up a camel context in it´s activator. I also created a target platform with hopefully all necessary bundles. In my context exchanges are created in a file endpoint and should be converted to string. There I get the exception: --- No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: java.lang.String An idea what I did wrong? Greetings Christian --- My Activator start method: public void start(BundleContext context) throws Exception { DefaultCamelContext ccontext = new DefaultCamelContext(); ccontext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from(file://d:/test).convertBodyTo(String.class).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); } }); ccontext.start(); } - My Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cameltest Bundle-SymbolicName: cameltest Bundle-Version: 1.0.0.qualifier Bundle-Activator: cameltest.Activator Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.osgi.framework;version=1.3.0 Require-Bundle: org.apache.camel.camel-core;bundle-version=2.3.0, org.apache.camel.camel-spring-osgi;bundle-version=2.3.0 -- My bundles in Equinox: ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.6.0.v20100422-1745 1 ACTIVE org.springframework.core_2.5.6.A 4 ACTIVE org.springframework.osgi.io_1.2.1 6 ACTIVE org.springframework.transaction_2.5.6.A 7 ACTIVE com.springsource.org.aopalliance_1.0.0 9 ACTIVE org.apache.camel.camel-spring-osgi_2.3.0.SNAPSHOT 12 ACTIVE org.springframework.context_2.5.6.A 13 ACTIVE org.springframework.beans_2.5.6.A 14 ACTIVE org.springframework.osgi.core_1.2.1 17 ACTIVE org.apache.camel.camel-core_2.3.0.SNAPSHOT 19 ACTIVE commons-management_1.0.0 20 ACTIVE org.springframework.aop_2.5.6.A 22 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 23 ACTIVE cameltest_1.0.0.qualifier -- http://www.liquid-reality.de
Problem using camel in osgi
Hi all, I am trying to get camel working in osgi. I wrote a simple bundle that starts up a camel context in it´s activator. I also created a target platform with hopefully all necessary bundles. In my context exchanges are created in a file endpoint and should be converted to string. There I get the exception: --- No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: java.lang.String An idea what I did wrong? Greetings Christian --- My Activator start method: public void start(BundleContext context) throws Exception { DefaultCamelContext ccontext = new DefaultCamelContext(); ccontext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from(file://d:/test).convertBodyTo(String.class).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); } }); ccontext.start(); } - My Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cameltest Bundle-SymbolicName: cameltest Bundle-Version: 1.0.0.qualifier Bundle-Activator: cameltest.Activator Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.osgi.framework;version=1.3.0 Require-Bundle: org.apache.camel.camel-core;bundle-version=2.3.0, org.apache.camel.camel-spring-osgi;bundle-version=2.3.0 -- My bundles in Equinox: ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.6.0.v20100422-1745 1 ACTIVE org.springframework.core_2.5.6.A 4 ACTIVE org.springframework.osgi.io_1.2.1 6 ACTIVE org.springframework.transaction_2.5.6.A 7 ACTIVE com.springsource.org.aopalliance_1.0.0 9 ACTIVE org.apache.camel.camel-spring-osgi_2.3.0.SNAPSHOT 12 ACTIVE org.springframework.context_2.5.6.A 13 ACTIVE org.springframework.beans_2.5.6.A 14 ACTIVE org.springframework.osgi.core_1.2.1 17 ACTIVE org.apache.camel.camel-core_2.3.0.SNAPSHOT 19 ACTIVE commons-management_1.0.0 20 ACTIVE org.springframework.aop_2.5.6.A 22 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 23 ACTIVE cameltest_1.0.0.qualifier -- http://www.liquid-reality.de
Re: Problem using camel in osgi
You may want to try using the osgi specific camel context instead, else you need to have all the components and converters available in your bundle classloader using imported package. On Saturday, May 22, 2010, Christian Schneider ch...@die-schneider.net wrote: Hi all, I am trying to get camel working in osgi. I wrote a simple bundle that starts up a camel context in it´s activator. I also created a target platform with hopefully all necessary bundles. In my context exchanges are created in a file endpoint and should be converted to string. There I get the exception: --- No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: java.lang.String An idea what I did wrong? Greetings Christian --- My Activator start method: public void start(BundleContext context) throws Exception { DefaultCamelContext ccontext = new DefaultCamelContext(); ccontext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from(file://d:/test).convertBodyTo(String.class).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); } }); ccontext.start(); } - My Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cameltest Bundle-SymbolicName: cameltest Bundle-Version: 1.0.0.qualifier Bundle-Activator: cameltest.Activator Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.osgi.framework;version=1.3.0 Require-Bundle: org.apache.camel.camel-core;bundle-version=2.3.0, org.apache.camel.camel-spring-osgi;bundle-version=2.3.0 -- My bundles in Equinox: ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.6.0.v20100422-1745 1 ACTIVE org.springframework.core_2.5.6.A 4 ACTIVE org.springframework.osgi.io_1.2.1 6 ACTIVE org.springframework.transaction_2.5.6.A 7 ACTIVE com.springsource.org.aopalliance_1.0.0 9 ACTIVE org.apache.camel.camel-spring-osgi_2.3.0.SNAPSHOT 12 ACTIVE org.springframework.context_2.5.6.A 13 ACTIVE org.springframework.beans_2.5.6.A 14 ACTIVE org.springframework.osgi.core_1.2.1 17 ACTIVE org.apache.camel.camel-core_2.3.0.SNAPSHOT 19 ACTIVE commons-management_1.0.0 20 ACTIVE org.springframework.aop_2.5.6.A 22 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 23 ACTIVE cameltest_1.0.0.qualifier -- http://www.liquid-reality.de -- Cheers, Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://fusesource.com
Re: Problem using camel in osgi
Hi Guillaume, as I import by bundle not package I think that I should have all TypeConverters available. The problem seems to be that they are not registered. Do you know how the registration of converters works in camel when running in osgi? Greetings Christian Am 22.05.2010 16:26, schrieb Guillaume Nodet: You may want to try using the osgi specific camel context instead, else you need to have all the components and converters available in your bundle classloader using imported package. On Saturday, May 22, 2010, Christian Schneiderch...@die-schneider.net wrote: Hi all, I am trying to get camel working in osgi. I wrote a simple bundle that starts up a camel context in it´s activator. I also created a target platform with hopefully all necessary bundles. In my context exchanges are created in a file endpoint and should be converted to string. There I get the exception: --- No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: java.lang.String An idea what I did wrong? Greetings Christian --- My Activator start method: public void start(BundleContext context) throws Exception { DefaultCamelContext ccontext = new DefaultCamelContext(); ccontext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from(file://d:/test).convertBodyTo(String.class).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); } }); ccontext.start(); } - My Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cameltest Bundle-SymbolicName: cameltest Bundle-Version: 1.0.0.qualifier Bundle-Activator: cameltest.Activator Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.osgi.framework;version=1.3.0 Require-Bundle: org.apache.camel.camel-core;bundle-version=2.3.0, org.apache.camel.camel-spring-osgi;bundle-version=2.3.0 -- My bundles in Equinox: ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.6.0.v20100422-1745 1 ACTIVE org.springframework.core_2.5.6.A 4 ACTIVE org.springframework.osgi.io_1.2.1 6 ACTIVE org.springframework.transaction_2.5.6.A 7 ACTIVE com.springsource.org.aopalliance_1.0.0 9 ACTIVE org.apache.camel.camel-spring-osgi_2.3.0.SNAPSHOT 12 ACTIVE org.springframework.context_2.5.6.A 13 ACTIVE org.springframework.beans_2.5.6.A 14 ACTIVE org.springframework.osgi.core_1.2.1 17 ACTIVE org.apache.camel.camel-core_2.3.0.SNAPSHOT 19 ACTIVE commons-management_1.0.0 20 ACTIVE org.springframework.aop_2.5.6.A 22 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 23 ACTIVE cameltest_1.0.0.qualifier -- http://www.liquid-reality.de -- http://www.liquid-reality.de
Re: Problem using camel in osgi
Seems the OsgiDefaultCamelContext does the trick. I will take a look into the source to understand what it is doing. Greetings Christian Am 22.05.2010 16:55, schrieb Christian Schneider: Hi Guillaume, as I import by bundle not package I think that I should have all TypeConverters available. The problem seems to be that they are not registered. Do you know how the registration of converters works in camel when running in osgi? Greetings Christian Am 22.05.2010 16:26, schrieb Guillaume Nodet: You may want to try using the osgi specific camel context instead, else you need to have all the components and converters available in your bundle classloader using imported package. On Saturday, May 22, 2010, Christian Schneiderch...@die-schneider.net wrote: Hi all, I am trying to get camel working in osgi. I wrote a simple bundle that starts up a camel context in it´s activator. I also created a target platform with hopefully all necessary bundles. In my context exchanges are created in a file endpoint and should be converted to string. There I get the exception: --- No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: java.lang.String An idea what I did wrong? Greetings Christian --- My Activator start method: public void start(BundleContext context) throws Exception { DefaultCamelContext ccontext = new DefaultCamelContext(); ccontext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from(file://d:/test).convertBodyTo(String.class).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); } }); ccontext.start(); } - My Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cameltest Bundle-SymbolicName: cameltest Bundle-Version: 1.0.0.qualifier Bundle-Activator: cameltest.Activator Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.osgi.framework;version=1.3.0 Require-Bundle: org.apache.camel.camel-core;bundle-version=2.3.0, org.apache.camel.camel-spring-osgi;bundle-version=2.3.0 -- My bundles in Equinox: ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.6.0.v20100422-1745 1 ACTIVE org.springframework.core_2.5.6.A 4 ACTIVE org.springframework.osgi.io_1.2.1 6 ACTIVE org.springframework.transaction_2.5.6.A 7 ACTIVE com.springsource.org.aopalliance_1.0.0 9 ACTIVE org.apache.camel.camel-spring-osgi_2.3.0.SNAPSHOT 12 ACTIVE org.springframework.context_2.5.6.A 13 ACTIVE org.springframework.beans_2.5.6.A 14 ACTIVE org.springframework.osgi.core_1.2.1 17 ACTIVE org.apache.camel.camel-core_2.3.0.SNAPSHOT 19 ACTIVE commons-management_1.0.0 20 ACTIVE org.springframework.aop_2.5.6.A 22 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 23 ACTIVE cameltest_1.0.0.qualifier -- http://www.liquid-reality.de -- http://www.liquid-reality.de