+

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!.

OSGi application support is deprecated in WAS traditional because OSGi applications depend on a technology that is no longer included in Equinox 4.4.0 and later. There is no strategic alternative in WAS traditional. To continue to use OSGi applications, migrate the applications to Liberty. In Liberty, OSGi applications run as Subsystems, which are a standard form of OSGi application. See Migrate applications to Liberty.

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 using IBM Rational Application Developer Version 8 or a similar tool.


Tasks

  1. Create your service bundle.
  2. Create the client bundle.
  3. Create your OSGi application.


What to do next

After we create your OSGi application, we can deploy the application to WAS 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.


Related:

  • The Blueprint Container
  • The WebSphere programming model and OSGi
  • OSGi applications
  • Developing a composite bundle
  • Best practices for developing and working with OSGi applications
  • Developing enterprise OSGi applications for WAS
  • OSGi application design guidelines
  • Writing extensible OSGi applications




    File name: was3417.html

    prettyPrint();