Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Deploy a Java application using Helm, Part 2

October 21, 2021
Daniel Oh
Related topics:
DevOpsHelmJavaKubernetes
Related products:
Red Hat JBoss Enterprise Application PlatformRed Hat OpenShift

Share:

    In the previous article in this series, you learned how to deploy Java applications to Red Hat JBoss Enterprise Application Platform (JBoss EAP) using Helm on Red Hat OpenShift. Developers can use the procedures in Part 1 to easily stand up traditional Java application servers on Kubernetes with predefined Kubernetes manifestos.

    What if you could have the same benefits when you develop microservices using JBoss EAP and Helm charts? JBoss EAP provides the Extension Pack (XP) to implement content trimming, packaging to a bootable JAR, and a MicroProfile specification including fault tolerance, monitoring, and tracing in support of microservices in the cloud. This article explains how to make a bootable JAR using JBoss EAP XP and Helm and deploy the application to OpenShift.

    Build a bootable JAR with JBoss EAP XP and Helm

    You will use the same Todo backend application that you deployed in the previous article. At the end of the tutorial, you will have both a traditional enterprise Java application and a bootable JAR for lightweight and independent deployment such as a microservices architecture, using a JBoss EAP XP Helm chart as shown in Figure 1.

    Note: The Helm charts for JBoss EAP 7.4 are a technology preview feature on OpenShift 4.8, so support is limited when you use these features in production environments.

    A diagram of the application development process using JBoss EAP, JBoss EAP XP, and a database.
    Figure 1. Application development process using JBoss EAP, JBoss EAP XP, and a database.

    Installing a JBoss EAP XP Helm chart

    Go to the developer console in Red Hat OpenShift and navigate to the Topology view. You will add the same project (eap-helm-demo) to OpenShift that you used in the previous article.

    Click the Add to Project icon on the left side and enter EAP into the search box. Then select the Eap Xp3 v1.1.0 Helm chart and click Install Helm Chart, as shown in Figure 2.

    Adding the JBoss EAP XP Helm chart.
    Figure 2. Adding the JBoss EAP XP Helm chart.

    Now define a specific build, image, and deployment for a bootable Todo back-end application. Switch to the YAML view to add build and deploy configurations, as shown in Figure 3. Use bootable JAR mode with the environment variables required for your PostgreSQL data source in your build. Also, set a single runtime using the replicas field in the deploy property:

    build:
      mode: bootable-jar
      env:
        - name: MAVEN_ARGS_APPEND
          value: -am -pl todo-backend -P bootable-jar-openshift
        - name: POSTGRESQL_DRIVER_VERSION
          value: '42.2.19'
    deploy:
      replicas: 1

    After you add the custom configuration in the YAML configuration, click on the Install button. You can find the entire YAML configuration at the Todo back-end repository.

    Adding a bootable jar configurations.
    Figure 3. Adding the bootable JAR configuration.

    Note: You will probably see an ErrImagePull or ImagePullBackOff message in the resources, as shown in Figure 4. Don't worry—your bootable JAR is building successfully, but your deployment will report ErrImagePull and ImagePullBackOff until the build is complete.

    ImagePullBackOff during deployment.
    Figure 4. ImagePullBackOff during deployment.

    Once the application build is complete, your image is automatically rolled out as shown in Figure 5. Create a connector between the JBoss EAP XP pod (Helm icon) and the PostgreSQL pod via the drag-and-drop feature in the Topology view.

    Successful build and deployment for JBoss EAP XP application.
    Figure 5. Successful build and deployment of your JBoss EAP XP application.

    When you click on Open URL, a new web page opens automatically. Copy the route URL for the next step.

    Testing the enterprise Java application

    When the deployment is complete, visit your Todo front-end application by opening a new window in a web browser and pasting in the route URL you copied in the previous step. Then click on the go button shown in Figure 6.

    To-do front-end GUI.
    Figure 6. Todo front-end GUI.

    Now you should be able to add, update, and remove items in the to-do list, as shown in Figure 7.

    To-do list.
    Figure 7. To-do list.

    What’s next

    This tutorial has shown how to make a bootable JAR with enterprise capabilities (e.g., database transactions) and deploy it to the cloud on Red Hat OpenShift using the JBoss EAP XP Helm chart. You can also define custom runtime environments such as health checks (e.g., livenessProbe, readinessProbe) and TLS termination. Then you can upgrade and roll back an existing Helm chart, applying the changes to the running bootable application instantly.

    Additional resources:

    • JBoss EAP XP 3.0.0 Quickstarts
    • Using MicroProfile with JBoss EAP XP 3.0.0
    • Red Hat JBoss EAP XP 3.0.0 Release Notes
    • Getting Started with JBoss EAP for OpenShift Container Platform
    Last updated: September 20, 2023

    Related Posts

    • Deploy a Java application using Helm, Part 1

    • Deploy Helm charts with Jenkins CI/CD in Red Hat OpenShift 4

    • Build Your "Hello World" Container Using Java

    • Deploy Node.js applications to Red Hat OpenShift with Helm

    • Deploy .NET applications on Red Hat OpenShift using Helm

    • You (probably) need liveness and readiness probes

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue