Taking the WebSphere Liberty Profile for a spin, using Intellij on the iMac

I've mainly worked at companies which are "IBM shops" - you know, those that use RAD as their IDE and WebSphere as their Application Server. Irrespective of the version working iteratively with JEE web applications has never been a joyous experience - sometimes the code is hot swapped, sometimes I have to restart the server, sometimes the server stops responding and I have to kill the process. Always the server is slow to start. Of course, the hardware makes a difference, but not enough - development should be quick, responsive and I should get instant feedback on my changes.

Having recently purchased a Mac, Intellij 12 in their "Doomsday Sale" and having my interest perked by the WebSphere liberty dev team giving an IAMA on Reddit, I thought I'd see how this setup compared to my usual setup i.e. Windows, RAD and WebSphere server with all its bells and bloat.

In this first post I walk through installing the WAS Liberty Next Profile and setting up a simple JEE6 project, via a Maven archetype. Full conclusions I'll leave for another post, when I've done some "proper" work, as opposed to the Mickey Mouse example described below.

Configuring the WebSphere Next Liberty profile (beta)

I've gone for the early access / beta version, which offers CDI, EJB Lite and Managed Beans support. This is called Next by the WebSphere team.

  • Download the jar file
  • Enter the terminal and install it:
    java -jar wlp-developers-runtime-8.5.next.beta.jar
  • Navigate to the installation directory and create a new server:
    bin/server create planetjones

Unfortunately Intellij is unable to recognise the new Next Profile, but copying 3 folders: /dev/api/ibm, /dev/api/spec and /dev/api/third-party into /dev/ seems a fair workaround until Intellij adds support. Note: I'm not sure why a profile where speed is the main concern, needs to be installed and a new instance created - unzipping it and being ready to go, would be easier.

Creating a skeletal project in Intellij

  • Create a new project from Intellij's quick start menu and choose Maven Module


  • Now click "Add Archetype" and enter:

  • Select this in the New Project window

  • Hit Finish and that's your project ready!
  • Configuring WAS Liberty Next Profile

    You may need to enable the WebSphere plugin at this point. Open Preferences (shortcut "cmd,") then go to Plugins and check "Websphere Integration".

    Open /usr/servers//server.xml and change it to the following: Intellij has a "Fix It" to do this change automatically, if you'd prefer.

    Go Run > Edit Configurations. Click the + sign and select WebSphere Server > Local. Hit Configure and enter the path to the WebSphere Liberty Next Profile e.g.

    /Users/planetjones/servers/wlp

    On the Deployment tab add the war artefact. Make sure exploded is chosen - this means Intellij can copy .class files and resources to the server when they change i.e. to reflect changes without a restart.

    On the Server tab set:

    • On 'Update' action = Update classes and resources
    • On frame deactivation = Update classes and resources

    Running, redeploying and hot swapping

    The Maven Archetype creates an index.jsp file in the root of the webapp. Hit the play icon to build and deploy your Web Application to Liberty:

    Open your web browser and voila:

    http://localhost:9080/liberty_profile_test_war_exploded/
    I got the whole thing started in just under 1 second - that's pretty good going. Updating the JSP file and switching to my web browser, means Intellj's frame deactivation kicks in and the updated JSP is copied to the exploded WAR. So the change is reflected without a restart. Now you can add a servlet e.g.

    When adding the new servlet Liberty needs a restart, but if I start the server in debug mode changes to the Servlet are reflected without requiring a restart (they're not unless Liberty is started in debug mode).

    I'll play with JSF, CDI, EJB Lite, etc. and add these to another post.