Getting started with JBoss (2024)

Posted: September 20, 2021 | | by Ashish Bharadwaj Madabhushana (Red Hat)

Image

Getting started with JBoss (1)

JBoss Enterprise Application Platform (EAP) is an enterprise-grade, open source platform to deploy highly transactional and scalable web applications. It includes everything you need to build, run, deploy, and manage enterprise-level Java applications in different environments—including on-premises, virtual environments, and private, public, and hybrid clouds.

This article explains some of what I have learned during my time with JBoss EAP, its operating modes, installing it, and managing the JBoss service. I will also show how to build and deploy a sample web application archive (WAR) file so that you can learn alongside me.

Understanding operating modes in JBoss EAP

JBoss EAP has two operating modes:

  • Standalone server mode:For managing discrete instances
  • Managed domain mode:For managing groups of instances from a single control point

The management capabilities are different depending on which operating mode you useto start the JBoss EAP installer.

Installing JBoss EAP

Before installing JBoss, ensure:

  • Java/JDK is installed on the system
  • The JBoss EAP admin user has installation directory read-write access

Then:

  1. Ensure Java/JDK is installed. If it's not, install it using yum install java.
  2. Download the JBoss EAP installer (.jar) file from the Red Hat portal.
  3. Create a directory where you want to save all your JBoss configuration files:
    [root@jboss-eap ~]# mkdir /jboss
  4. Run the JBoss installer:
    [jboss-eap Downloads]# java -jar jboss-eap-7.4.0-installer.jar

Executing this command opens the JBoss graphical installer where you can configure all your settings, installation paths, and more.

Below are a few images from the installation process:

Image

Getting started with JBoss (3)

Image

Getting started with JBoss (4)

Follow the onscreen instructions and complete the installation process. Note that the default settings are fine for basic installation.

Image

Getting started with JBoss (5)

Starting JBoss EAP

As I wrote above, JBoss EAP can runin either standalone mode or domain mode. The command to start JBoss EAP depends on the underlying platform and the operating mode.

[ You might also be interested in seeing how Linux sysadmins answer: What's your favorite IDE? ]

The commands to startJBoss EAP are:

  • Standalone server:
    [jboss-eap Downloads]# /jboss/bin/standalone.sh
  • Managed domain:
    [jboss-eap Downloads]# /jboss/bin/domain.sh

JBoss EAP listens on port 9990 by default. Visit 127.0.0.1:9990 to accessyour locally installed and running JBoss console. Provide the username and password to log into the JBoss management console.

Image

Getting started with JBoss (6)

Stopping JBoss EAP

To stop an interactive instance of JBoss EAP, pressCtrl+Cin the terminal where JBoss EAP was started.

To stop a background instance of JBoss EAP, use the management command-line interface (CLI) to connect to the running instance and shut it down.

Launch the management CLI and issue the shutdown command:

[jboss-eap ~]# /jboss/bin/jboss-cli.sh --connect[standalone@localhost:9990 /] shutdown​​​​​​​[disconnected /]

Then pressCtrl+Cto go back to your shell.

Building a WAR file

A WAR fileis an archive that contains all the files related to a web application project. It includes Java class files, Jakarta Server Pages (JSPs), HTML pages, and many other resources.

[ Download now: A system administrator's guide to IT automation.]

To build a WAR file, first, you need to create WEB-INF and WEB-INF/classes directories. You can also use the web.xml file in WEB-INF.

Createyour own WAR file:

[jboss-eap ~]# jar cvf<war-filename><files-to-be-added into war>[jboss-eap ~]# jar cvf test.war WEB-INF/ hello.jsp index.html

Verify the contents of a WAR file:

[jboss-eap ~]# jar tvf test.war

Create a project directory, say example, and copy the WAR file into it:

[jboss-eap jboss]# mkdir /jboss/examples[jboss-eap ~]# cp test.war /jboss/examples

You can also download prebuilt, open source WAR files, copy them into the JBoss directory, and use them.

Deploying a WAR file through the command line

As the JBoss documentationstates, deploying applications using the management CLI gives you the benefit of a single CLI with the ability to create and run deployment scripts. Following are the commands you need to handle various tasks.

  1. Start the JBoss server in standalone mode:
    [jboss-eap ~]# /jboss/bin/standalone.sh
  2. Connect to the JBoss command line:
    [jboss-eap ~]# /jboss/bin/jboss-cli.sh --connect[standalone@localhost:9990 /]
  3. Deploy an application (provide the full path to the WAR file)
    [standalone@localhost:9990 /] deploy /jboss/examples/test.war[standalone@localhost:9990 /]
    The application is successfully deployed and available at http : //127.0.0.1:8080/test.

    Image

    Getting started with JBoss (7)

  4. List the deployments:
    [standalone@localhost:9990 /] deployment infoNAME RUNTIME-NAME PERSISTENT ENABLED STATUS​​​​​​​test.war test.war true true OK
    You can also view the deployments information from the admin management console at 127.0.0.1:9990.

    Image

    Getting started with JBoss (8)

    Image

    Getting started with JBoss (9)

  5. Undeploy an application:
    [standalone@localhost:9990 /] undeploy test.war​​​​​​​[standalone@localhost:9990 /] deployment info

Wrapping up

In this article, you learned about the JBoss EAP andits operating modes, downloaded and executed the JBoss installer, managed the JBoss service, created and built a sample WAR file, and deployed the WAR file through the command line. Finally, you listed the deployment information by connecting to the JBoss CLI, and you've also done deployments from the management console. If you'd like to learn more about JBoss, check out the getting started page.

Topics: Java Programming

Getting started with JBoss (2024)
Top Articles
Latest Posts
Article information

Author: Golda Nolan II

Last Updated:

Views: 5781

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Golda Nolan II

Birthday: 1998-05-14

Address: Suite 369 9754 Roberts Pines, West Benitaburgh, NM 69180-7958

Phone: +522993866487

Job: Sales Executive

Hobby: Worldbuilding, Shopping, Quilting, Cooking, Homebrewing, Leather crafting, Pet

Introduction: My name is Golda Nolan II, I am a thoughtful, clever, cute, jolly, brave, powerful, splendid person who loves writing and wants to share my knowledge and understanding with you.