Introduction: Develop a simple OSGi application
This tutorial demonstrates how to create an OSGi application and run it on either WebSphere® Application Server traditional or Liberty. The OSGi application consists of an OSGi web bundle that contains a servlet that accesses a service that is provided in another bundle project. This tutorial is an introduction to using OSGi application development tools.
Learning objectives
In this tutorial, the following learning objectives are met:- Create an OSGi bundle and an OSGi application.
- Create and configure an OSGi blueprint configuration file.
- Configure component dependencies.
- Add dependency injection within a bundle.
- Add dependency injection between bundles.
- Deploy an OSGi application to a server.
Time required
This tutorial takes approximately 90 minutes to finish. If you explore other concepts that are related to this tutorial, it might take longer to complete.Prerequisites
Install WebSphere Application Server.
Tip: You can run this tutorial on WebSphere Application
Server Versions Liberty 7.0, 8.0, 8.5 and 8.5.
Learn more about installing WebSphere Application Server Version 7.0: To run this sample on WebSphere Application Server traditional Version 7.0, you must install the Feature Pack for
OSGi Applications and Java™ Persistence API 2.0. To Install the
feature pack:
- Open the IBM® Installation Manager.
- Click Install. The Install Packages page opens.
- In the package list, select IBM WebSphere Application Server traditional Version 7.0 Test Environment, then click Next.
- Read the license agreements. Accept the license agreements then click Next.
- Follow the instructions in the Installation Manager to install WebSphere Application Server traditional Version 7.0.
- In the Features list, ensure that you select OSGi Applications under IBM WebSphere Application Server traditional Version 7.0 Feature Pack for OSGi Applications and Java Persistence API 2.0.