You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by GFO <gu...@soprasteria.com> on 2018/01/04 11:05:21 UTC

Bundle dependencies in prod env

Hello,

I have a question about dependencies in Karaf.

I have a bundle which contains a lot of dependencies:
	- jars created by me
	- third party jars

Those dependencies may have transitive dependencies.

To deploy my application in a production environment I would like a zip file
which contains my bundle and all its dependencies.

What is the best way to achieve that?

1/ A kar file which contains a feature.xml file? And wrap every non-OSGi
dependency (more than 50 dependencies...) ?
2/ A basic zip file which contains my bundle and my libs in another
directory? In this case, how can I tell Karaf to look at the "lib directory"
to resolve dependencies for my bundle ?
3/ Another solution?

Thanks a lot,
GFO



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Bundle dependencies in prod env

Posted by Guillaume Nodet <gn...@apache.org>.
The deployment packaging does not have to be tied to the release cycle /
code management.
Think about the simple use case where you implement a public interface: you
don't release the API (it may never change), but you're still free to embed
the API in your bundle or not.

Also, the use case for embedding a package which is exported is different
than embedding a package which is private.

2018-01-05 5:44 GMT+01:00 Francois Papon <fr...@openobject.fr>:

> Hi,
>
> I think it's better to separate bundle interface and bundle
> implementation, you can have many implementations of the same interface
> (like OSGi specifications) and you can release a new implementation
> version without release the api version. Generally, implementations
> bundles are releases more frequently than interfaces bundles, but this
> is my understanding :)
>
> François
>
>
> Le 05/01/2018 à 02:46, David Jencks a écrit :
> > Why do you advise that fat bundles should be avoided? My current idea of
> good osgi design is to only export service interfaces, and generally
> package the interfaces with the implementations; since jarA and libA aren’t
> even bundles they are good candidates for hiding inside bundleA since they
> are quite unlikely to contain both exported interfaces and osgi-usable
> implementations.
> >
> > Thanks
> > David Jencks
> >
> > Sent from my iPhone
> >
> >> On Jan 4, 2018, at 9:21 AM, Jean-Baptiste Onofré <jb...@nanthrax.net>
> wrote:
> >>
> >> Did you check your import/export ?
> >>
> >> Creating a uber bundle is also an option, but fat bundles should be
> avoided.
> >>
> >> Regards
> >> JB
> >>
> >>> On 01/04/2018 06:18 PM, GFO wrote:
> >>> Hi,
> >>> Thanks for your answer.
> >>> I have tried to create a kar file: my bundle does not find some
> dependencies
> >>> although dependencies are started as bundles.
> >>> I have the following dependencies:
> >>> BundleA (mine) depends on jarA (mine) which depends on libA (third
> party).
> >>> jarA and libA are wrapped as bundles in Karaf.
> >>> BundleA finds the jarA but BundleA tell me it does not find libA
> (class not
> >>> found). Why does BundleA do not find libA by itself?
> >>> Another question: what about embeding all the jars in the bundle
> instead of
> >>> creating a feature (for instance via maven-bundle-plugin and
> >>> Embed-Dependency directive)? Does it make a big difference?
> >>> Thanks
> >>> GFO
> >>> --
> >>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> >> --
> >> Jean-Baptiste Onofré
> >> jbonofre@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
>
>


-- 
------------------------
Guillaume Nodet

Re: Bundle dependencies in prod env

Posted by Francois Papon <fr...@openobject.fr>.
Hi,

I think it's better to separate bundle interface and bundle
implementation, you can have many implementations of the same interface
(like OSGi specifications) and you can release a new implementation
version without release the api version. Generally, implementations
bundles are releases more frequently than interfaces bundles, but this
is my understanding :)

François


Le 05/01/2018 à 02:46, David Jencks a écrit :
> Why do you advise that fat bundles should be avoided? My current idea of good osgi design is to only export service interfaces, and generally package the interfaces with the implementations; since jarA and libA aren’t even bundles they are good candidates for hiding inside bundleA since they are quite unlikely to contain both exported interfaces and osgi-usable implementations.
>
> Thanks 
> David Jencks
>
> Sent from my iPhone
>
>> On Jan 4, 2018, at 9:21 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>
>> Did you check your import/export ?
>>
>> Creating a uber bundle is also an option, but fat bundles should be avoided.
>>
>> Regards
>> JB
>>
>>> On 01/04/2018 06:18 PM, GFO wrote:
>>> Hi,
>>> Thanks for your answer.
>>> I have tried to create a kar file: my bundle does not find some dependencies
>>> although dependencies are started as bundles.
>>> I have the following dependencies:
>>> BundleA (mine) depends on jarA (mine) which depends on libA (third party).
>>> jarA and libA are wrapped as bundles in Karaf.
>>> BundleA finds the jarA but BundleA tell me it does not find libA (class not
>>> found). Why does BundleA do not find libA by itself?
>>> Another question: what about embeding all the jars in the bundle instead of
>>> creating a feature (for instance via maven-bundle-plugin and
>>> Embed-Dependency directive)? Does it make a big difference?
>>> Thanks
>>> GFO
>>> --
>>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com


Re: Bundle dependencies in prod env

Posted by David Jencks <da...@gmail.com>.
Why do you advise that fat bundles should be avoided? My current idea of good osgi design is to only export service interfaces, and generally package the interfaces with the implementations; since jarA and libA aren’t even bundles they are good candidates for hiding inside bundleA since they are quite unlikely to contain both exported interfaces and osgi-usable implementations.

Thanks 
David Jencks

Sent from my iPhone

> On Jan 4, 2018, at 9:21 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Did you check your import/export ?
> 
> Creating a uber bundle is also an option, but fat bundles should be avoided.
> 
> Regards
> JB
> 
>> On 01/04/2018 06:18 PM, GFO wrote:
>> Hi,
>> Thanks for your answer.
>> I have tried to create a kar file: my bundle does not find some dependencies
>> although dependencies are started as bundles.
>> I have the following dependencies:
>> BundleA (mine) depends on jarA (mine) which depends on libA (third party).
>> jarA and libA are wrapped as bundles in Karaf.
>> BundleA finds the jarA but BundleA tell me it does not find libA (class not
>> found). Why does BundleA do not find libA by itself?
>> Another question: what about embeding all the jars in the bundle instead of
>> creating a feature (for instance via maven-bundle-plugin and
>> Embed-Dependency directive)? Does it make a big difference?
>> Thanks
>> GFO
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: Bundle dependencies in prod env

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Did you check your import/export ?

Creating a uber bundle is also an option, but fat bundles should be avoided.

Regards
JB

On 01/04/2018 06:18 PM, GFO wrote:
> Hi,
> 
> Thanks for your answer.
> 
> I have tried to create a kar file: my bundle does not find some dependencies
> although dependencies are started as bundles.
> 
> I have the following dependencies:
> 
> BundleA (mine) depends on jarA (mine) which depends on libA (third party).
> 
> jarA and libA are wrapped as bundles in Karaf.
> 
> BundleA finds the jarA but BundleA tell me it does not find libA (class not
> found). Why does BundleA do not find libA by itself?
> 
> 
> Another question: what about embeding all the jars in the bundle instead of
> creating a feature (for instance via maven-bundle-plugin and
> Embed-Dependency directive)? Does it make a big difference?
> 
> Thanks
> GFO
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Bundle dependencies in prod env

Posted by GFO <gu...@soprasteria.com>.
Hi,

Thanks for your answer.

I have tried to create a kar file: my bundle does not find some dependencies
although dependencies are started as bundles.

I have the following dependencies:

BundleA (mine) depends on jarA (mine) which depends on libA (third party). 

jarA and libA are wrapped as bundles in Karaf. 

BundleA finds the jarA but BundleA tell me it does not find libA (class not
found). Why does BundleA do not find libA by itself?


Another question: what about embeding all the jars in the bundle instead of
creating a feature (for instance via maven-bundle-plugin and 
Embed-Dependency directive)? Does it make a big difference?

Thanks
GFO



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Bundle dependencies in prod env

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

1/ If you really want a zip file, then take a kar.
If you want to work with a repo, feature is better.
2/ It's possible using fileinstall and specifying your folder
3/ Cave can be an option too (with Bundle Repository).

Regards
JB


On 01/04/2018 12:05 PM, GFO wrote:
> Hello,
> 
> I have a question about dependencies in Karaf.
> 
> I have a bundle which contains a lot of dependencies:
> 	- jars created by me
> 	- third party jars
> 
> Those dependencies may have transitive dependencies.
> 
> To deploy my application in a production environment I would like a zip file
> which contains my bundle and all its dependencies.
> 
> What is the best way to achieve that?
> 
> 1/ A kar file which contains a feature.xml file? And wrap every non-OSGi
> dependency (more than 50 dependencies...) ?
> 2/ A basic zip file which contains my bundle and my libs in another
> directory? In this case, how can I tell Karaf to look at the "lib directory"
> to resolve dependencies for my bundle ?
> 3/ Another solution?
> 
> Thanks a lot,
> GFO
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com