You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bryce Ewing <br...@gmail.com> on 2010/07/21 11:15:30 UTC
OSGi Camel issue: org.apache.camel.core.osgi is private in
camel-spring
Hi,
In the upgrade from camel 2.2.0 to 2.4.0 there was a refactoring of OSGi
support. One change was the deprecating of the camel-osgi component in
favor of camel-spring. I am not using spring as such in my application
(obviously certain parts do use it but it isn't a spring based application).
What I was using for the camel context was OsgiDefaultCamelContext which is
within the camel-core-osgi module.
This module is embedded into the camel-spring component but the
org.apache.camel.core.osgi is set as a private package and therefore the
class is no longer available at run time.
To get around this I have also embedded this module into the bundle that I
am creating the camel context within. This doesn't seem right to me, either
the OsgiDefaultCamelContext should no longer be used and I am just going
about things in the wrong way, or the package shouldn't be private.
Cheers
Bryce
--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-Camel-issue-org-apache-camel-core-osgi-is-private-in-camel-spring-tp1695625p1695625.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OSGi Camel issue: org.apache.camel.core.osgi is private in
camel-spring
Posted by Bryce Ewing <br...@gmail.com>.
Hi Willem,
Thanks for pointing that out. I couldn't quite use CamelContextFactoryBean
easily (due to not having an application context) but it pointed me in the
right direction at least, found that what I needed was:
protected CamelContext getCamelContext(ComponentContext
componentContext) {
CamelContextFactory contextFactory = new CamelContextFactory();
contextFactory.setBundleContext(componentContext.getBundleContext());
return contextFactory.createContext();
}
Again leaving the creation of the underlying OsgiDefaultCamelContext to the
factory within camel-spring.
Cheers
Bryce
--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-Camel-issue-org-apache-camel-core-osgi-is-private-in-camel-spring-tp1695625p2164142.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OSGi Camel issue: org.apache.camel.core.osgi is private in camel-spring
Posted by Willem Jiang <wi...@gmail.com>.
Bryce Ewing wrote:
> Hi,
>
> In the upgrade from camel 2.2.0 to 2.4.0 there was a refactoring of OSGi
> support. One change was the deprecating of the camel-osgi component in
> favor of camel-spring. I am not using spring as such in my application
> (obviously certain parts do use it but it isn't a spring based application).
> What I was using for the camel context was OsgiDefaultCamelContext which is
> within the camel-core-osgi module.
>
> This module is embedded into the camel-spring component but the
> org.apache.camel.core.osgi is set as a private package and therefore the
> class is no longer available at run time.
Because camel-spring and camel-blueprint embed the same camel-core-osgi,
so this package org.apache.camel.core.osgi had to be private, and they
are just for internal using.
>
> To get around this I have also embedded this module into the bundle that I
> am creating the camel context within. This doesn't seem right to me, either
> the OsgiDefaultCamelContext should no longer be used and I am just going
> about things in the wrong way, or the package shouldn't be private.
I think you should use the CamelContextFactoryBean in the camel-spring
module to create the CamelContext instead of using the
OsigDefaultCamelContext directly.
>
> Cheers
> Bryce
Willem
----------------------------------
Apache Camel, Apache CXF committer
Open Source Integration http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang