Questions tagged [osgi]

The OSGi (Open Service Gateway Initiative) framework is a module system and service platform for the Java programming language that implements a complete and dynamic component model.

The Open Service Gateway Initiative or commonly named OSGi is a specification for a Java component framework with enforced modularity. It provides a comprehensive model to build applications out of smaller, reusable parts. Though it works with any Java code, its advantages are best obtained by using its strong modularity. OSGi encapsulates each JAR in its own class loader and selectively exports packages. OSGi then links each module to the package/module versions they need thereby addressing JAR hell since multiple versions of the same package/module are allowed in OSGi. It also provides for private packages, i.e. packages not visible to any other module.

OSGi modules are normal JAR files with their metadata in the manifest, expressing the module's requirements and capabilities (e.g. import/export package, but extendable). OSGi modules are reified in runtime and have a life cycle. They can be installed, resolved, started, stopped, and uninstalled. Module code can run at start/stop time and an extensive event mechanism is the basis for numerous middleware that simplifies writing modules.

Popular Java factory/DI models collide with strong modularity (these model require implementation class names to be known outside their module). To alleviate this clash, the OSGi provides a modular solution to finding and sharing instances between modules, the so called (µ)services model. A consequence of the strong modularity is that OSGi can hot-swap modules without restarting the application. This is very useful during development but can also be used in server based applications.

All popular Java Application servers are either built on top of OSGi or fully support its module specification. The two popular open source OSGi frameworks are Felix and Equinox. Equinox is the foundation on which Eclipse is built. For the Java embedded world there are implementations like Knopflerfish, Concierge, Prosyst (commercial) as well as several private implementations.

The OSGi Alliance is a worldwide consortium of technology innovators that advances a proven and mature process to create open specifications that enable the modular assembly of software built with Java technology. The OSGi Service Platform facilitates the componentization of software modules and applications and assures interoperability of applications and services over a variety of networked devices.

6201 questions
16
votes
10 answers

Which Rich Client Platform to use

We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: Eclipse RCP - www link to ecipse rcp, Netbean RCP - Netbeans RCP web site, Spring RCP - spring…
Peter Osborne
  • 479
  • 2
  • 4
  • 11
16
votes
5 answers

Glassfish as an OSGi Container

I'm evaluating OSGi containers and the subject came up of using Glassfish to contain my OSGi application components. My question is: Is Glassfish good for this? Does anybody have any experience using it in this way? Background: - The application is…
kender
  • 181
  • 1
  • 6
16
votes
1 answer

XDocReport converting ODT to PDF with OSGI

To start to work with XDocReport I want to convert ODT to PDF. All my application is OSGi. So I install the following…
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
16
votes
3 answers

How to start osgi console (Equinox)

I'm trying to start an OSGi console in Windows 7. I used this statement on a terminal window: java -jar org.eclipse.osgi.jar -console But it doesn't work that is nothing does happen nor doesn't appear prompt osgi>. And typing on keyboard is…
Andrea Scarpa
  • 161
  • 1
  • 1
  • 6
16
votes
1 answer

Maven Bundle Plugin: Export has private references

After updating the maven-bundle-plugin from version 2.3.5 to version 2.4.0 running mvn clean install outputs some warning messages, which I don't fully understand. E.g. Export ch.entwine.weblounge.contentrepository.impl.index, has 1, private…
Basil
  • 638
  • 1
  • 9
  • 16
16
votes
3 answers

Prioritizing OSGi service selection within a container when more than one implementation exist

I am playing with OSGi and have a few bundles. Bundle A and B both contain a registered service which implements a single interface. The third bundle C includes code to lookup a service implementing the previously mentioned interface. The A and B…
mP.
  • 18,002
  • 10
  • 71
  • 105
16
votes
3 answers

Search OSGI services by properties

How can I distinguish between published OSGI services implementing same interface by their properties?
John Smith
  • 233
  • 1
  • 2
  • 10
15
votes
4 answers

Using an OSGi Bundle from a Java Web Application in Tomcat

I am trying to invoke a method of an OSGi bundle from a Java Web Application. Both are supposed to run on Tomcat 7. I already wrote a normal Java application that invokes methods from the OSGi bundle, as described on this site:…
Nicolas
  • 472
  • 6
  • 14
15
votes
4 answers

Efficient OSGi development workflow

I work on a product composed of many bundles running as features on top of karaf. Typically our developers work on one bundle at a time. Our normal development goes something like: code, compile, copy bundle to deploy folder, test. We've also found…
Jon7
  • 7,165
  • 2
  • 33
  • 39
15
votes
3 answers

maven-bundle-plugin fails with "Invalid class file module-info.class"

After adding a dependency that contains a JPMS module, the maven-bundle-plugin (version 3.3.0) fails with: [INFO] --- maven-bundle-plugin:3.3.0:bundle (default-bundle) @ my-bundle --- [ERROR] Bundle myGroup:my-bundle:bundle:1.0 : Exception:…
gjoranv
  • 4,376
  • 3
  • 21
  • 37
15
votes
7 answers

How to write eclipse rcp applications with scala?

The Scala Eclipse plugin page says: * Support for Eclipse plugin and OSGi development including hyperlinking to Scala source from plugin.xml and manifest files. How does this support work? There's no wizards for making Scala plugins. I've found no…
Olli Aalto
  • 183
  • 1
  • 6
15
votes
4 answers

Has anyone found OSGi to be useful in corporate applications?

Has anyone deployed a corporate application in OSGi and found it useful? I can see the benefits, forced modularity, good dependency definitions etc. But these seem to be mainly build related improvements. Has anyone found it useful to dynamically…
Fortyrunner
  • 12,702
  • 4
  • 31
  • 54
15
votes
3 answers

Java 6 - Annotation processor and code addition

I wrote a custom annotation containing metadata for a property and an AnnotationProcessor: @SupportedAnnotationTypes({".Property"}) public class PropertyProcessor extends AbstractProcessor { @Override public boolean process(Set
Deniz Acay
  • 1,609
  • 1
  • 13
  • 24
15
votes
3 answers

OSGi vs Spring vs Struts vs EJB vs. Hibernate -- a totally newbie's question

I am not familiar with these "framework" "components" at all, but can someone give me a 101 introduction about what the relationship they are to each other? Basically, I want to know roughly about: what and what are counterparts to each other what…
sean
  • 159
  • 1
  • 1
  • 4
15
votes
4 answers

Using maven-bundle-plugin with the maven-shade-plugin

I'm using the maven-shade-plugin to relocate some packages during the package phase of my build. I'm also using the maven-bundle-plugin to generate a manifest. The problem is the bundle plugin runs before the shade plugin (during the process-classes…
Jonathan
  • 5,027
  • 39
  • 48