+

Search Tips   |   Advanced Search

Develop an OSGi application

As an introduction to developing an OSGi application, we can develop a simple HelloWorld OSGi application, which consists of two bundles. One bundle defines a hello service, and the other is a client bundle that uses this service to produce the message OSGi Service: Hello World!.

An OSGi application is a Java™ application that uses OSGi technologies. OSGi applications are collections of OSGi bundles (typically bundles that use the Blueprint component model), and can expose or consume a number of services. The OSGi application described in these topics demonstrates the use of the OSGi service registry to share the hello service between the defining bundle and the client bundle. All interactions with the service registry are handled through Blueprint.

OSGi bundles are packaged as JAR files with a .jar extension. A single OSGi application is packaged in an enterprise bundle archive (EBA) file with a .eba extension, just as an enterprise application is packaged in an EAR file with a .ear extension. In this example application, the bundles are packaged directly in the EBA file. However, the EBA file does not have to contain the bundles; they can be pulled in at run time.

The steps in the following procedure are specific to this example application, and lead you through creating the application artifacts by using IBM Rational Application Developer Version 8 or a similar tool.

  1. Create your service bundle.

  2. Create your client bundle.

  3. Create the OSGi application.


What to do next

After creating the OSGi application, we can deploy the application to WebSphere Application Server by using either the administrative console or wsadmin commands; for details, see Deploy an OSGi application as a business-level application.

We might also want to explore the sample OSGi applications.


Subtopics


Parent topic: Develop OSGi applications


Related concepts

  • The Blueprint Container
  • The WebSphere programming model and OSGi
  • OSGi applications


    Related tasks

  • Develop a composite bundle


    Best practices for developing and working with OSGi applications
    Develop enterprise OSGi applications for WebSphere Application Server

  • OSGi application design guidelines
  • Writing extensible OSGi applications