Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Using third party libraries with OSGi

 
Greenhorn
Posts: 5
Android Eclipse IDE C++
  • 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,
 
author
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.
 
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
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.
 
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.
 
I am displeased. You are no longer allowed to read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!