• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using third party libraries with OSGi

 
Migue Carvajal
Greenhorn
Posts: 5
Android C++ Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

We have had some trouble using third party libraries in OSGi. Sometimes, our approach has been "bundlelize" the library, and this has revealed new troubles related to dependencies with other libraries, this end in a very big bundle containing a lot of dependent components.
Do you recommend any strategies to cope with this situations?

Thanks in advance,
 
Richard S. Hall
author
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Migue Carvajal wrote:
We have had some trouble using third party libraries in OSGi. Sometimes, our approach has been "bundlelize" the library, and this has revealed new troubles related to dependencies with other libraries, this end in a very big bundle containing a lot of dependent components.
Do you recommend any strategies to cope with this situations?


We cover this topic in the book. The simplest approach is to create one big self-contained bundle, but it depends on your situation. If you can already find bundle-ized versions of most of the dependencies, then keeping them separate is probably the best choice. This is definitely a hurdle when moving toward OSGi, but it is improving.
 
Augusto Sellhorn
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard S. Hall wrote:
The simplest approach is to create one big self-contained bundle, but it depends on your situation.


You mean embedded jars in the bundle? We ended up having to do that after bnd wrapping all dependencies wouldn't work in all cases.
 
Richard S. Hall
author
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Augusto Sellhorn wrote:
Richard S. Hall wrote:
The simplest approach is to create one big self-contained bundle, but it depends on your situation.


You mean embedded jars in the bundle? We ended up having to do that after bnd wrapping all dependencies wouldn't work in all cases.


Yes or just expanding them into the bundle, you don't necessarily need to embed the classes in their original JAR files.
 
Mike Van
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard S. Hall wrote:
Augusto Sellhorn wrote:
Richard S. Hall wrote:
The simplest approach is to create one big self-contained bundle, but it depends on your situation.


You mean embedded jars in the bundle? We ended up having to do that after bnd wrapping all dependencies wouldn't work in all cases.


Yes or just expanding them into the bundle, you don't necessarily need to embed the classes in their original JAR files.


Another approach you can use when making use of third party libraries that are not OSGi bundles, is to (in Karaf) wrap them when you install them.

For example, if you're installing a .jar file using the karaf console, and you want to wrap it as it is installed you'd do something like this:


This instructs Karaf to use the bnd library available in Karaf to wrap that non-OSGi bundle prior to installing it. The -s flag instructs Karaf to start the bundle once the jar is wrapped and installed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic