You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lleclerc <ll...@aim-rg.com> on 2012/11/27 22:07:10 UTC
OSGI dependencies with camel
Hi,
I got a maven project that use camel-core and camel-http4.
The project works having both dependency.
Now I want to load this project into my OSGI container (I use Apache
Geronimo 3.0).
While running on the IDE, all the classes are loaded in the same
classLoader, so camel-core is able to find camel-http4. But running my
project on geronimo, camel-core cannot find camel-http4 because they are 2
independent bundle.
What happens in IDE :
MyProject depends {camel-core, camel-http4}
What happens using OSGI :
MyProject depends {camel-core}, {camel-http4} and camel-core can't find
camel-http4.
That's my understanding of the problem.
What is the best solution to resolve camel-http4 in camel-core using OSGI
Bundles ?
We have been trying something using ComponentResolver and @Inject. Is it the
right way ?
--
View this message in context: http://camel.465427.n5.nabble.com/OSGI-dependencies-with-camel-tp5723319.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OSGI dependencies with camel
Posted by lleclerc <ll...@aim-rg.com>.
In the end, we use @Inject to be able to access the ComponentResolver
available from the dependency and then resolve the component and add it to
the camelContext.
@Inject .multiple()
Iterable<ComponentResolver> resolvers;
Component comp = resolver.resolveComponent(CAMEL_HTTP4, camelContext);
camelContext.addComponent(CAMEL_HTTP4, comp);
The dependency is added through resolve, and found using the string "http4"
and is not directly linked to any Class of the camel-http4 jar.
--
View this message in context: http://camel.465427.n5.nabble.com/OSGI-dependencies-with-camel-tp5723319p5723351.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OSGI dependencies with camel
Posted by Willem jiang <wi...@gmail.com>.
I'm not sure if your IDE container can make sure the camel-core and camel-http4 bundle start before your bundle started.
If it can do that, you don't need to add the hard code of camel-http4 in your bundle.
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang
On Wednesday, November 28, 2012 at 8:35 AM, lleclerc wrote:
> The error is "No component found with scheme http4".
>
> I think I could fix it.
>
> What I think is like this :
> > What happens in IDE :
> > MyProject depends {camel-core, camel-http4}
> >
> > What happens using OSGI :
> > MyProject depends {camel-core}, {camel-http4} and camel-core can't find
> > camel-http4 even though MyProject use it in a from("http4:...")
>
>
>
> So I am linking both bundles, by myself, in the code with those lines :
>
> Component c = new HttpComponent();
> camelContext.addComponent("http4", c);
>
> I was trying to add a dependency to a dependency, just for MyApp osgi, which
> is not the right way to do it...
>
> I haven't had time to fully test it and I am not at work right now, will
> tell you result tomorrow!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/OSGI-dependencies-with-camel-tp5723319p5723321.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: OSGI dependencies with camel
Posted by lleclerc <ll...@aim-rg.com>.
The error is "No component found with scheme http4".
I think I could fix it.
What I think is like this :
> What happens in IDE :
> MyProject depends {camel-core, camel-http4}
>
> What happens using OSGI :
> MyProject depends {camel-core}, {camel-http4} and camel-core can't find
> camel-http4 even though MyProject use it in a from("http4:...")
So I am linking both bundles, by myself, in the code with those lines :
Component c = new HttpComponent();
camelContext.addComponent("http4", c);
I was trying to add a dependency to a dependency, just for MyApp osgi, which
is not the right way to do it...
I haven't had time to fully test it and I am not at work right now, will
tell you result tomorrow!
--
View this message in context: http://camel.465427.n5.nabble.com/OSGI-dependencies-with-camel-tp5723319p5723321.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OSGI dependencies with camel
Posted by Christian Müller <ch...@gmail.com>.
What's your issue? Can you share your stack trace? Which version of
Geronimo/Camel do you use?
As far as I know, Geronimo is based on Karaf. An Camel is shiped with a
feature file for Karaf to install all the dependencies - and it works.
Best,
Christian
Sent from a mobile device
Am 27.11.2012 22:07 schrieb "lleclerc" <ll...@aim-rg.com>:
> Hi,
>
> I got a maven project that use camel-core and camel-http4.
> The project works having both dependency.
>
> Now I want to load this project into my OSGI container (I use Apache
> Geronimo 3.0).
>
> While running on the IDE, all the classes are loaded in the same
> classLoader, so camel-core is able to find camel-http4. But running my
> project on geronimo, camel-core cannot find camel-http4 because they are 2
> independent bundle.
>
> What happens in IDE :
> MyProject depends {camel-core, camel-http4}
>
> What happens using OSGI :
> MyProject depends {camel-core}, {camel-http4} and camel-core can't find
> camel-http4.
>
> That's my understanding of the problem.
>
> What is the best solution to resolve camel-http4 in camel-core using OSGI
> Bundles ?
>
>
> We have been trying something using ComponentResolver and @Inject. Is it
> the
> right way ?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/OSGI-dependencies-with-camel-tp5723319.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>