JBoss Tutorial for Beginners

Welcome to the JBoss Tutorial for Beginners! In this comprehensive guide, we’ll walk you through the fundamental concepts of JBoss, helping you understand the basics and kickstart your journey into the world of Java-based application servers.

Overview of JBoss products

Firstly, to disambiguate, we should clarify that, with the terms “JBoss” we generally refer to JBoss Enterprise Application Platform, which is the middleware supported by Red Hat. If you want to use the upstream version of JBoss EAP, then you can download WildFly application server. This article discusses more in depth the differences between the two products: JBoss EAP vs WildFly: The definitive guide

Key features of WildFly include:

  1. Jakarta EE Compatibility: WildFly is fully Jakarta EE-compatible and implements the specifications defined by the Java Community Process (JCP). It supports a wide range of Jakarta EE technologies, such as servlets, JavaServer Pages (JSP), Enterprise JavaBeans (EJB), Java Persistence API (JPA), and more.
  2. Modular Architecture: WildFly has a modular and lightweight architecture, allowing developers to choose only the components they need for their specific applications. This modularity enhances flexibility and helps reduce the server’s footprint.
  3. Fast Startup and Low Memory Usage: WildFly is designed for efficiency, with a focus on fast startup times and minimal memory consumption. This makes it well-suited for both development and production environments.
  4. Highly Configurable: WildFly provides extensive configuration options, allowing administrators to fine-tune the server according to the specific requirements of their applications. This flexibility makes it suitable for a variety of use cases.
  5. Clustering and High Availability: WildFly supports clustering and high-availability configurations, enabling the deployment of applications in clustered environments for improved scalability and reliability.
  6. Management and Administration: WildFly includes a web-based administration console, as well as a command-line interface, for managing and monitoring the server. It offers features such as runtime management, application deployment, and resource configuration.
  7. Active Community and Support: Being an open-source project with active community involvement, WildFly benefits from continuous improvement, updates, and support. Red Hat, the main sponsor of the project, also provides commercial support for those who require it.
jboss tutorial for beginners

In the next part of this tutorial, we will show how do download and install WildFly. Then, we will proceed with the deployment of a sample application.

JBoss Tutorial Part 1: Installing the server

Before we begin, ensure you have the following prerequisites installed on your system:

  1. Java Development Kit (JDK) – Modern versions of WildFly requires JDK 11 or later.
  2. Maven build tool. You can download it from here .

Step 1: Download and Install WildFly

  1. Visit the official WildFly download page: WildFly Downloads.
  2. Choose the desired WildFly version. For beginners, it’s recommended to start with the latest stable release.
  3. Download the ZIP distribution suitable for your operating system (Windows, Linux, or macOS).
  4. Extract the downloaded ZIP file to a location on your machine.

Step 2: Start WildFly

  1. Open a terminal or command prompt.
  2. Navigate to the WildFly installation directory.
  3. Execute the following command to start WildFly:
standalone.sh

This command will start WildFly in standalone mode, which means there will be a single JVM process that will serve your requests. Verify from the Server Console that WildFly started correctly:

16:01:12,361 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 7.0.0.Final (Apache CXF 4.0.0) 
16:01:12,362 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory /home/francesco/jboss/wildfly-31.0.0.Beta1/standalone/deployments
16:01:12,410 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
16:01:12,412 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
16:01:12,412 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
16:01:12,413 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 31.0.0.Beta1 (WildFly Core 23.0.0.Beta4) started in 206ms - Started 288 of 530 services (318 services are lazy, passive or on-demand) - Server configuration file in use: standalone.xml

Finally, access the landing page of WildFly which is available by default at localhost:8080:

jboss tutorial for beginners

JBoss Tutorial Part 2: Deploying a sample application

Next, we will deploy your first application on WildFly. There is a rich set of examples in the WildFly quickstarts repository: https://github.com/wildfly/quickstart

Download the repository on your machine. Then, we will show how to deploy one of the examples. Change the directory to the helloworld folder:

$ cd helloworld

From there, launch the install Maven goal followed by the wildfly:deploy Command. The latter goal will deploy the application on WildFLy using its Maven plugin. To learn more about this plugin, check this article: How to configure and run Maven WildFly plugin

mvn install wildfly:deploy

On your first Maven build it will take some time to fetch all libraries and build the project. Finally, verify from the Console that the deployment was successful:

16:08:48,955 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 81) WFLYUT0021: Registered web context: '/helloworld' for server 'default-server'
16:08:48,987 INFO  [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "helloworld.war" (runtime-name : "helloworld.war")

Then, request the Servlet HelloWorld from the browser or the command line:

$ curl http://localhost:8080/helloworld/HelloWorld

<html><head><title>helloworld</title></head><body>
<h1>Hello World!</h1>
</body></html>

You can finish this JBoss tutorial with a taste of the Command Line Interface which is available in the bin folder of WildFly.

/bin/jboss-cli.sh -c

The CLI will connect automatically if you provide the -c parameter.

Firstly, undeploy the helloworld application:

undeploy helloworld.war

Then, shutdown WildFly:

shutdown

Conclusion

In this tutorial we have learnt how to install WildFly and deployed the “Hello World” quickstart application. Also we discussed some basic application server maintenance by using the Command Line Interface which is an advanced tool to manage JBoss/WIldFly.

Found the article helpful? if so please follow us on Socials