Bookmark this page

Lab: Configuring JBoss EAP in Standalone Mode

Create two new directories outside of the JBoss EAP installation folder as a base directory, run two standalone servers with a port offset, and use the management console to increase the log level for a category.

Resources
Directories /opt/jboss/standalone /opt/jboss/standalone2
Application URL http://localhost:19990 http://localhost:9990
Resources N/A

Outcomes

You should be able to run two instances of JBoss EAP with a port offset, by using a custom base directory. Then, you use the management console to customize a standalone server.

Use the following command to prepare the relevant lab directory:

[student@workstation ~]$ lab start standalone-review

Instructions

  1. To avoid interfering with the base install of JBoss EAP, and to maintain a backup of the server configuration, create a new base directory for JBoss EAP. Use the current JBoss EAP installation owned by user jboss, located at /opt/jboss-eap-7.4. Copy the required directories as the jboss user into the lab directory located at the /opt/jboss/standalone directory.

    [student@workstation ~]$ cd /opt/jboss-eap-7.4/standalone
    [student@workstation standalone]$ sudo -u jboss \
    cp -r configuration deployments lib /opt/jboss/standalone
  2. Change to the jboss user and start a JBoss EAP standalone server that uses the /opt/jboss/standalone directory as its base directory. Wait for the server to finish starting up before proceeding.

    1. Use the following commands to start JBoss EAP.

      [student@workstation standalone]$ cd /opt/jboss-eap-7.4/bin
      [student@workstation bin]$ sudo -u jboss  ./standalone.sh \
      -Djboss.server.base.dir=/opt/jboss/standalone/
    2. Verify the server is running, by accessing the management console at http://localhost:9990 and by checking the terminal output for a message similar to the following:

      07:29:53,990 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.4.11.GA (WildFly Core 15.0.26.Final-redhat-00001) started in 4449ms - Started 318 of 557 services (343 services are lazy, passive or on-demand)

      Leave this instance of JBoss EAP running.

  3. Your organization wants to be able to run two standalone servers of JBoss EAP concurrently in order to configure the server differently for separate applications.

    Open a new terminal window and create a new base directory for another server based on the original installation of JBoss EAP located at /opt/jboss-eap-7.4. Use the directory /opt/jboss/standalone2 as the base directory for the new instance of JBoss EAP.

    [student@workstation bin]$ cd /opt/jboss-eap-7.4/standalone
    [student@workstation standalone]$ sudo -u jboss \
    cp -r configuration deployments lib /opt/jboss/standalone2
  4. Start a new JBoss EAP instance avoiding port conflicts by using the command-line parameter to set an offset of 10000. The new server management console should listen on port 19990.

    Verify that you use the jboss user to execute the commands.

    [student@workstation standalone]$ sudo -u jboss \
    /opt/jboss-eap-7.4/bin/standalone.sh \
    -Djboss.server.base.dir=/opt/jboss/standalone2/ \
    -Djboss.socket.binding.port-offset=10000
  5. Wait for the second server to finish starting.

    Then, navigate to the management console. Use admin as username and redhat123 as password. Update the log level of the CONSOLE handler and set it to DEBUG. You can configure the handler in the handler section of the logging subsystem.

    Restart the server to view the debug information displayed the console.

    1. Access the management console at http://localhost:19990.

    2. Click Configuration at the top of the management console. In the first column, click Subsystems and then in the second column click Logging. Click Configuration in the third column, and then View.

    3. Click Handler at the first column, and then click Console Handler to access the configuration page for the Console handler.

    4. Select the CONSOLE row in the table.

    5. Click Edit.

    6. Change the Level from INFO to DEBUG.

      Then click Save.

      Location of the console logging handler in the management console
    7. Stop the instance of the JBoss EAP listening on port 19990 by pressing Ctrl+C on the terminal where it is running. Then, use the following command to start the server again as the jboss user:

      [student@workstation standalone]$ sudo -u jboss \
      /opt/jboss-eap-7.4/bin/standalone.sh \
      -Djboss.server.base.dir=/opt/jboss/standalone2/ \
      -Djboss.socket.binding.port-offset=10000

      Verify the server is running by accessing the management console at http://localhost:19990.

    8. Observe the additional debug information provided by the server in the console that reflects the log level change made in the management console:

      ...output omitted...
      03:17:07,260 DEBUG [org.jboss.as.config] (MSC service thread 1-1) Configured system properties:
      	[Standalone] =
      	awt.toolkit = sun.awt.X11.XToolkit
      	file.encoding = UTF-8
      	file.separator = /
      	java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
      	java.awt.headless = true
      	java.awt.printerjob = sun.print.PSPrinterJob
      	java.class.path = /opt/jboss-eap-7.4/jboss-modules.jar
      	java.class.version = 55.0
      	java.home = /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-6.el9.x86_64
      	java.io.tmpdir = /tmp
      
      ...output omitted...
  6. Optionally, access the management console for the first server, and observe that the Console handler log level is still set to INFO. The first server did not change because the two servers have different configuration files in their respective base directories.

  7. Stop the instances of JBoss EAP by pressing Ctrl+C in each terminal window that is running JBoss EAP. Use the following command to run the grading script:

    [student@workstation bin]$ lab grade standalone-review

Finish

As the student user on the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish standalone-review

Revision: ad248-7.4-18a9db2