Getting Started With IBM WAS Liberty
Getting Started With IBM WAS Liberty
Follow along as you get an introduction to IBM's WAS Liberty Profile server. In the first part of a series, see what you can expect to do when setting up a server.
Join the DZone community and get the full member experience.Join For Free
Learn how to stop testing everything every sprint and only test the code you’ve changed. Brought to you by Parasoft.
For a recent project requiring WebSockets and JMS, I needed to make use of IBM’s WAS Liberty Profile server, as WAS 8.5 ND only supports JEE 6. I want to share some of my learnings with you, starting with the basics: a short intro on what to expect and setting up a server.
Some highlights of WAS Liberty are:
- The server configuration is easily version controlled, as the server is separate from the WAS Liberty runtime.
- You can use the server as a deployment artifact (as opposed to an EAR or WAR).
- You choose which features you want to use and the server runtime spins up only those. This makes for faster start-up times and less waste. For a recent project, I used parts of JEE 7 (web sockets, JMS, CDI, etc).
- The runtime comes with various flavors:
- Manual ZIP download (which is what I did, you can grab a JEE7 at WASDev)
- You can install it via Eclipse and Websphere Developer Tools (I used eclipse Neon and pointed the WAS Liberty tools to my already-installed JEE 7 runtime);
- You can install it using the Liberty Maven plugin, which also comes with toys to manage the server as part of integration tests.
- You can use a Docker image. Have a look at this article on Eclipse WDT and Docker.
- Once the server is running, you can hot-deploy applications and configuration to it, no restart required.
- You can develop on it for free and run a VERY small prod setup with it (total JVM heap space of 2GB across all Liberty servers);
- If your company is already using WAS Network Deploy, your license probably already includes Liberty.
Basics for Getting Started
Luckily, IBM has created extensive tutorials and articles on various key concepts, including getting started with Liberty in Eclipse. So I'm not going to re-add everything here, although in a future article, I will be showing you some of its tricks.
So, to get started quickly, read on to create a server. If you're interested in more, go over to WASDev and browse through all the articles.
Create a Server
Once you have a runtime installed (or a Maven project available to do it), you can create a WAS Liberty server as follows.
From eclipse (assuming you have WDT - Websphere Developer Tools - installed via eclipse marketplace) go to the Servers tab, right-click and New -> Server -> Websphere Application Server Liberty and fill out the wizard. It will ask you to point to an existing installation or you can download it via WDT at this stage.
From the command line, go to the Liberty Runtime installation location (e.g. /WAS-Liberty), then
cd wlp/bin && server create myServer” to make it happen. You can then start the server with “
server start testServer” to start it I the background, or “
server run defaultServer” to see how it starts up in the cmd/bash/whatever you’re using.
You can read more on available commands here.
WAS Liberty is a lot simpler to use than WAS traditional. If you can't use it for production yet, please consider using it in development, due to its fast spin-up time. Just note: as Liberty can include features not supported by WAS Classic/Traditional, make sure your dev Liberty install has the same features as your production runtime.
Keep an eye out for my follow-up article(s) on how to build a WebSocket server with WAS Liberty, build and packaging with Maven, and using the WAS Liberty built-in JMS capabilities.
Opinions expressed by DZone contributors are their own.