OSGi Hello World
This sample demonstrates how to create a simple OSGi application and run it on WebSphere® Application Server. The OSGi application consists of an OSGi web bundle that contains a servlet and an activator that identifies the lifecycle of the bundle in the Console view. This sample is an introduction to using OSGi application development tools.
Tip: You can run this sample on WebSphere Application Server traditional Versions 7.0, 8.0, and 8.5. You
can also run this sample on WebSphere Application Server
Liberty.
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.
Learn more about installing WebSphere Application Server Version 8.0: To run this sample on WebSphere Application Server traditional Version 8.0, you must install the server:
- Open the IBM Installation Manager.
- Click Install. The Install Packages page opens.
- In the package list, select IBM WebSphere Application traditional Server Version 8.0, 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 8.0.
Learn more about installing WebSphere Application Server Version 8.5: To run this sample on WebSphere Application Server traditional Version 8.5, you must install the server:
- Open the IBM Installation Manager.
- Click Install. The Install Packages page opens.
- In the package list, select IBM WebSphere Application Server traditional Version 8.5, 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 8.5.
Learn more about installing WebSphere Application Server Liberty: To run this sample on WebSphere Application Server Liberty, you must install the server. See Installing Liberty for more information.
To
deploy your OSGi Hello World application to a server:
- In Enterprise Explorer, expand .
- Right-click HelloServlet and select . The Run On Server dialog opens.
- Click WebSphere Application Server from the list of servers and click Finish.
The string Hello OSGi World! is displayed in the browser.