#HOWTO: Deploy a Spring Boot Uber-Jar application within Open Liberty

While I was scrolling through my twitter feed I noticed a post about the new Open Liberty release on June 29. In the official blog post about the new release, they pointed out that Open Liberty now fully supports JavaEE 8 (JAX-RS 2.1, JPA 2.2, JSF 2.3 and so on ..) and that they offer a feature to run a typical Spring Boot application, packaged as an Uber-Jar, within Open Liberty. Right after I read the blog post I jumped into the first investigation about this feature about which I want to blog about today.

To demonstrate this feature I implemented a simple Spring Boot (Java version: 1.8, Spring Boot version: 2.0.3.RELASE) based chat application makes use of Websockets, an in-memory H2 database, and a REST endpoint. The packaging version in the pom.xml is still jar and I did not exclude Tomcat as the servlet container. For visualization purposes, I created a simple Javascript-based “Chat” frontend:

In this blog post, I don’t want to focus on the implementation of chat app because it’s quite similar to the sample applications on the internet about Websockets with Spring. For the deployment within Open Liberty, you don’t have to change or add code to your Spring application at any point (e.g. pom.xml, application.properties etc.).

For the deployment, you need the Open Liberty server on your local machine, which is available at (https://openliberty.io/downloads/). After downloading and extracting the zip file, navigate to the wlp folder and run bin/server start defaultServer (use bin/server.bat start defaultServer if you are running on Windows). Starting the defaultServer for the first time, you will get a usr/server/defaultServer folder within your wlp folder.

Now you have to open the server.xml file within this folder and change it to the following if you are using my example application later on:

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">


    <httpEndpoint id="defaultHttpEndpoint"
                  httpsPort="9443" />

    <applicationManager autoExpand="true"/>
    <springBootApplication location="spring-boot-with-open-liberty.jar"/>

If you are familiar with the configuration of Open Liberty/Websphere Liberty, you will notice the new feature <feature>springBoot-2.0</feature> which is responsible for the correct deployment of our Spring Boot application. At the time of writing Open Liberty supports this feature for Spring Boot 1.5.X and 2.0.X applications. The already started defaultServer will receive the configuration changes and will update automatically (no restart needed).

In addition, I enabled the servlet-4.0 and websocket-1.1 feature to run my application because Open Liberty will use the Liberty web container instead of my embedded Tomcat. To effectively deploy the application Open Liberty offers several ways to this. I choose the explicit way where you have to a <springBootApplication location=“”/> section to your server.xml to identify the app you want to deploy. In the server.xml above, this section is already added.

Now you have to build your Spring application with Maven or Gradle and copy the build artifact to the /apps folder within wlp/usr/servers/defaultServer (make sure the name of your jar and the location reference in your sever.xml match). Open Liberty will detect the deployment of the app and will start your Spring Boot application. The console log of your Spring application and the Open Liberty server is stored in wlp/usr/servers/defaultServer/logs/console.log. The application is now available on http://localhost:9080 and you can start chatting or get all chat message from the REST endpoint at http://localhost:9080/api/messages.

You can find the Spring Boot application on my GitHub repository if you want to try this on your machine.

See you,





  1. Courious June 30, 2018 at 9:41 pm

    But I don’t understand what are the benefits?

    1. rieckpil June 30, 2018 at 9:53 pm

      Thanks for your comment, I think one benefit might be a more efficient deployment using Docker if you manage and separate the embedded dependencies of your Spring Boot application. With a ‘thinner’ jar file you can reduce the network throughput and improve your deployment duration for example as you just push the latest Docker layer to the cloud. This can also be achieved if you package your Spring Boot application as a war but I think with this new Open Liberty feature it’s quite more convenient for Spring Boot developer.

      1. rieckpil July 3, 2018 at 5:30 am

        Thank you Thomas for the Link

Leave a comment

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