Simon Maple and Cameron McKenzie on WebSphere Liberty |Video upload date:  · Duration: PT2M2S  · Language: EN

Practical guide to running WebSphere Liberty on Raspberry Pi with setup steps and deployment tips from Simon Maple and Cameron McKenzie.

Quick overview

Yes you can run WebSphere Liberty on a Raspberry Pi. No it will not magically become a cloud server. What you get is a compact Java server that can live on tiny hardware for IoT projects or demos. This guide walks through the essentials on a minimal Linux image with OpenJDK and Liberty runtime so you can deploy a simple WAR and tune memory like a responsible adult.

What you need

  • Raspberry Pi with a reasonably fast SD card
  • Raspberry Pi OS or another minimal Linux image
  • OpenJDK installed via package manager, for example openjdk 8 jdk
  • WebSphere Liberty runtime downloaded and extracted to a folder such as /opt/wlp

Prepare the board

Flash a current Raspberry Pi OS image and apply updates. A slow card will make the server sad and you slow too. Then install Java with the package manager. Example commands to run from a shell with sudo rights

sudo apt update
sudo apt install openjdk-8-jdk

Confirm the Java path and version with java -version. If you need a different OpenJDK build pick the package that matches your Pi architecture.

Install WebSphere Liberty

Unpack the Liberty runtime into a sensible location such as /opt/wlp. Keep the runtime owned by the user or service account you will use to run the server. Set JAVA_HOME in the profile used by your service so Liberty picks up the right JDK when it starts. A simple export example that you can place in a profile file is shown here

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-armhf

Deploy a sample app and minimal server config

Copy a WAR into the apps folder for your server profile under /opt/wlp/usr/servers. Use a tiny server.xml that enables HTTP and only the features you need. Minimality keeps startup time low and memory usage reasonable. Example server.xml

<server>
  <featureManager>
    <feature>servlet-3.1</feature>
  </featureManager>
  <httpEndpoint host="*" httpPort="9080" />
</server>

Start the server with the provided script under the runtime bin folder. For a server named defaultServer the command looks like this

/opt/wlp/bin/server start defaultServer

Access the application from a browser on the same network by pointing to the Pi IP address and port 9080. If your network name resolution acts up use the numeric IP instead.

Logs and trouble shooting

Logs live under the server logs folder in the runtime, for example /opt/wlp/usr/servers/yourServer/logs. Monitor messages.log and console log output to diagnose startup problems or runtime exceptions. Tail them while you reproduce the issue to see the offending stack traces in real time.

Memory tuning and performance tips

  • Lower JVM heap sizes to suit the modest RAM on a Pi. Try -Xmx512m and -Xms256m as starting points
  • Avoid heavy swapping, it will make the server feel like molasses
  • Disable features you do not need so Liberty uses fewer resources

Wrap up and where this fits

This tutorial gives the practical steps to run a small Java server on Raspberry Pi with Liberty and OpenJDK. It is handy for IoT prototypes, demos, and learning about running Java on constrained Linux hardware. If you want deeper tuning look at server jvm options and feature selection, and consult the Liberty documentation for advanced configuration. And if you are here because you saw a talk by Simon Maple or Cameron McKenzie you are in good company, they would approve of small servers that punch above their weight.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.