This tutorial will explain how to create, deploy and test a simple user feature with WAS Liberty V8.5.5.

Before you begin make sure you have downloaded and installed the following:

Create a runtime environment and a new server

  1. Select File > New > Other
  2. In the wizard dialog, type this filter text: server
  3. Select the Server wizard and click Next
  4. Choose the server type: WebSphere Application Server V8.5 Liberty Profile
  5. Set the server name: defaultServer
  6. Click Next
  7. Under the installation folder, enter the location where you installed the Liberty Profile runtime environment
  8. Click Finish

You can try starting and stopping this server to test it and to get familiar with the console output. It isn’t configured to do anything so it should start and stop quickly with very little console output.

Tip: You may want to reposition your Console pane in Eclipse so that you can see it at the same time as the Servers pane. By default they occupy the same location and you have to switch between them.

Create an OSGi Bundle

This bundle will contain the code for the feature.

  1. File > New > OSGI Bundle Project
  2. Name it: UserFeatureBundle
  3. Set the target runtime as the Liberty Profile runtime environment you created
  4. Do NOT add the bundle to an application (uncheck this option)
  5. Click Next
  6. Click Next
  7. Check the option to generate an Activator
  8. Click Finish

Implement the Bundle

In the newly created project, create a new packaged called and inside of that package create a class called HelloWorld, with the following code:

    public class HelloWorld {
          public String getHelloWorld() {
               return "Hello World!";

Now open the Activator class and add the following to the start method:

public void start(BundleContext context) throws Exception {
              HelloWorld hw = new HelloWorld();

Create the Feature

The define this bundle as a user feature we need to do the following:

  1. File > New > Other
  2. Type the filter text: feature
  3. Select the Liberty Feature Project wizard
  4. Set the project name: UserFeature
  5. Choose the Liberty Profile target runtime
  6. Click Next
  7. Ensure that the previously created bundle is selected
  8. Click Finish

Install the bundle

The installation of features has been made significantly easier by the V8.5.5 tooling, all that is now required is to:

  1. Right-click on the Liberty Feature Project that we just created and choose install feature…
  2. Ensure the Liberty Runtime is selected
  3. Click Finish.

Your custom user feature should now be installed and ready to use. The last step is to include it within your server.xml, to do this:

  1. Click on the Servers tab (Window > Show View > Other and type Servers if it is not already open).
  2. Expand the liberty server and open the Server Configuration [server.xml] file.
  3. In the design view highlight the Feature Manager section.
  4. Click the Add button under Feature Manager Details and then type usr:.
  5. Click the usr:UserFeature and then OK
  6. Finally, save your configuration and start your liberty server
  7. confirm that the “Hello World!” message we created earlier outputs in the console.

7 comments on"Create your own simple “Hello World” User Feature"

  1. Sebastien Brunot August 05, 2016

    Do you have any pointers that explains how to add unit tests in the OSGi bundle project and make sure that these tests .class are not included in the OSGi bundle jar (by the eclipse build) ?

  2. Eltayeb Elzain October 30, 2014

    Worked fine for me !!

  3. Error while installing feature .

    Could not install Liberty feature ‘testOwnCustomFeature’ on all selected runtime environments
    Error occurred while installing Liberty feature to runtime: WebSphere Application Server V8.5 Liberty Profile
    Failed to install feature: Process did not complete and had to be terminated

  4. I don’t see Liberty Feature Project wizard using WebSphere Application Server V8.5 Liberty Profile Developer Tools for Eclipse 3x.

    • Hi, the Liberty Feature Project wizard is only available with the V8.5.5 tools for Juno, not the tools for Eclipse 3x.

  5. download & installation links mentioned in Prerequisites section doesn’t work.

    • Laura Cowen June 27, 2013

      Hi obidul,

      Could you give it another go? The links seem to be working now. If you still have problems, could you let me know exactly what you see?


Join The Discussion

Your email address will not be published. Required fields are marked *