JBoss Wildfly

Russell Bateman
February 2022
last update:



I'm a Tomcat guy. I was driven to this by the need to run the Gazelle Validator which is EAR. WildFly used to be JBoss back eons ago when I used it very briefly. Here are the steps in my experience today:

  1. Install Java 11:
    # apt-get install openjdk-11-jdk        # (dnf install java-11-openjdk-devel)
    
    but, I already have that:
    russ@tirion ~ $ java --version
    openjdk 11.0.13 2021-10-19
    OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04)
    OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
    russ@tirion ~ $ echo ${JAVA_HOME}
    /home/russ/dev/jdk-11.0.10+9
    
  2. Download from WildFly downloads:
    russ@tirion ~/Downloads/wildfly $ ll
    total 212496
    drwxrwxr-x  2 russ russ      4096 Feb 22 16:08 .
    drwxr-xr-x 26 russ russ     12288 Feb 22 16:08 ..
    -rw-rw-r--  1 russ russ 217573228 Feb 22 16:08 wildfly-26.0.1.Final.tar.gz
    russ@tirion ~/Downloads/wildfly $ tar -zxf wildfly-26.0.1.Final.tar.gz 
    russ@tirion ~/Downloads/wildfly $ ll wildfly-26.0.1.Final
    total 544
    drwxr-xr-x 11 russ russ   4096 Jan 20 03:43 .
    drwxrwxr-x  3 russ russ   4096 Feb 22 16:09 ..
    drwxr-xr-x  3 russ russ   4096 Jan 20 03:43 appclient
    drwxr-xr-x  3 russ russ   4096 Feb 22 16:09 bin
    -rw-r--r--  1 russ russ  19358 Jan 20 03:43 copyright.txt
    drwxr-xr-x  6 russ russ   4096 Jan 20 03:43 docs
    drwxr-xr-x  4 russ russ   4096 Jan 20 03:43 domain
    drwxr-xr-x  2 russ russ   4096 Jan 20 03:43 .installation
    -rw-r--r--  1 russ russ 456439 Jan 20 03:43 jboss-modules.jar
    -rw-r--r--  1 russ russ  26530 Jan 20 03:43 LICENSE.txt
    drwxr-xr-x  3 russ russ   4096 Jan 20 03:43 modules
    -rw-r--r--  1 russ russ   2162 Jan 20 03:43 README.txt
    drwxr-xr-x  6 russ russ   4096 Jan 20 03:43 standalone
    drwxr-xr-x  2 russ russ   4096 Feb 22 16:09 welcome-content
    drwxr-xr-x  3 russ russ   4096 Jan 20 03:43 .well-known
    
  3. Install Wildfly...

    The application server ships with two server modes: standalone and domain mode. The difference between the two modes is not about the capabilities available but is related to the management of the application server: in particular, the domain mode is used when you run several instances of WildFly and you want a single point where you can manage servers and their configuration.

    In order to start WildFly using the default configuration in "standalone" mode, change the directory to ${JBOSS_HOME}/bin. Except, I'm going to have fuss a bit with installation and configuration first:

    1. I'm going to install (move) WildFly to /opt/wildfly on my host as if a proper application. (Of course, if it were a proper application, I'd set up the /etc/alternatives structure in the filesystem correctly too, but, for now, I'll leave that as an exercise.)
      russ@tirion ~/Downloads/wildfly $ sudo mv wildfly-26.0.1.Final /opt/
      russ@tirion ~/Downloads/wildfly $ sudo bash
      root@tirion:/home/russ/Downloads/wildfly# cd /opt
      root@tirion:/opt# ln -s wildfly-26.0.1.Final/ ./wildfly
      root@tirion:/opt# ll
      drwxr-xr-x 11 root  root    4096 Feb 22 16:26 ./
      drwxr-xr-x 20 root  root    4096 Jan 30  2021 ../
      drwxr-xr-x  6 root  root    4096 Jun  7  2021 apache-maven-3.8.1/
      drwxr-xr-x  9 root  tomcat  4096 May 11  2021 tomcat/
      lrwxrwxrwx  1 root  root      21 Feb 22 16:26 wildfly -> wildfly-26.0.1.Final//
      drwxr-xr-x 11 russ  russ    4096 Jan 20 03:43 wildfly-26.0.1.Final/
      
    2. My problem is that, of course, Tomcat is already running on 8080. So, let's try to fix that:
      root@tirion:/opt/wildfly# find . -name standalone.xml
      ./standalone/configuration/standalone.xml
      root@tirion:/opt/wildfly# vim ./standalone/configuration/standalone.xml
          .
          .
          .
          <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
              <socket-binding name="ajp" port="${jboss.ajp.port:4009}"/>
              <socket-binding name="http" port="${jboss.http.port:4040}"/>
              <socket-binding name="https" port="${jboss.https.port:4443}"/>
              <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:4440}"/>
              <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:4443}"/>
              <socket-binding name="txn-recovery-environment" port="4712"/>
              <socket-binding name="txn-status-manager" port="4713"/>
              <outbound-socket-binding name="mail-smtp">
                  <remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
              </outbound-socket-binding>
          </socket-binding-group>
          .
          .
          .
      
    3. For now, I won't show how to install it as a service since I don't yet think I will need that.
  4. Now, launch WildFly...
    root@tirion:/opt/wildfly# find . -name standalone.sh
    ./bin/standalone.sh
    root@tirion:/opt/wildfly# ./bin/standalone.sh
    =========================================================================
    
      JBoss Bootstrap Environment
    
      JBOSS_HOME: /opt/wildfly
    
      JAVA: java
    
      JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMe...
    
    =========================================================================
    
    16:46:04,750 INFO  [org.jboss.modules] (main) JBoss Modules version 2.0.0.Final
    16:46:05,082 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.13.Final
    16:46:05,087 INFO  [org.jboss.threads] (main) JBoss Threads version 2.4.0.Final
    16:46:05,153 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 26.0.1.Final (WildFly Core 18.0.4.Final) starting
    .
    .
    .
    16:46:06,512 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 26.0.1.Final (WildFly Core 18.0.4.Final) started in 1971ms - Started 298 of 538 services (337 services are lazy, passive or on-demand)
    16:46:06,513 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:4440/management
    16:46:06,513 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:4440
    
  5. Verify it's running by going to http://localhost:4040.

  6. How to deploy an EAR file to WildFly?

    Here's where; analogous to Tomcat's webapps subdirectory:
    root@tirion:/opt/wildfly# find . -name deployments
    ./standalone/deployments
    russ@tirion ~/Downloads/gazelle $ ll
    total 67144
    drwxrwxr-x  2 russ russ     4096 Feb 22 15:50 .
    drwxr-xr-x 26 russ russ    12288 Feb 22 16:50 ..
    -rw-rw-r--  1 russ russ 68736414 Feb 22 15:50 GazelleHL7v2Validator-ear-3.7.4.ear
    russ@tirion ~/Downloads/gazelle $ sudo cp GazelleHL7v2Validator-ear-3.7.4.ear /opt/wildfly/standalone/deployments/
    

    How to tell you've deployed it? First, if you haven't installed WildFly as a service (controlled using systemd using systemctl, you should have a console up running WildFly. You'll see evidence at the bottom of that which is the service output.

    Second, whether or not you've installed WildFly as a service or are looking for this in its output, what's seen in the output is also in a file named server.log:

    root@tirion:/opt/wildfly# find . -name server.log
    ./standalone/log/server.log
    root@tirion:/opt/wildfly# tail -f standalone/log/server.log
    
    16:46:06,513 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:4440/management
    16:46:06,513 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:4440
    06:23:04,919 INFO  [org.jboss.as.repository] (DeploymentScanner-threads - 2) WFLYDR0001: Content added at location /opt/wildfly/standalone/data/content/15/e50016e2b33fedda32440f73eb57cff4b4cb8c/content
    06:23:04,930 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "GazelleHL7v2Validator-ear-3.7.4.ear" (runtime-name: "GazelleHL7v2Validator-ear-3.7.4.ear")
    06:23:09,109 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb-api.jar in /content/GazelleHL7v2Validator-ear-3.7.4.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    06:23:09,109 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry activation.jar in /content/GazelleHL7v2Validator-ear-3.7.4.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    06:23:09,109 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jsr173_1.0_api.jar in /content/GazelleHL7v2Validator-ear-3.7.4.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    06:23:09,110 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb1-impl.jar in /content/GazelleHL7v2Validator-ear-3.7.4.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "jboss-seam-2.3.1.Final.jar")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0207: Starting subdeployment (runtime-name: "gazelle-gdpr-ejb-1.2.jar")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0207: Starting subdeployment (runtime-name: "GazelleHL7v2Validator-ejb.jar")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0207: Starting subdeployment (runtime-name: "GazelleHL7v2Validator-ui.war")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0207: Starting subdeployment (runtime-name: "version-1.0.3.jar")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0207: Starting subdeployment (runtime-name: "gazelle-seam-tools-jar.jar")
    06:23:09,119 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0207: Starting subdeployment (runtime-name: "mbval-documentation-ejb.jar")
    06:23:09,403 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for GazelleHL7v2Validator-PersistenceUnit
    06:23:09,620 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ui.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ui.war".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ui.war
    .
    .
    .
        Caused by: org.jboss.modules.ModuleNotFoundException: org.postgresql"
    }}
    06:23:09,657 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "GazelleHL7v2Validator-ear-3.7.4.ear" (runtime-name : "GazelleHL7v2Validator-ear-3.7.4.ear")
    06:23:09,657 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report
    WFLYCTL0186:   Services which failed to start:      service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.gazelle-gdpr-ejb-1.2.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.gazelle-gdpr-ejb-1.2.jar
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.version-1.0.3.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.version-1.0.3.jar
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.mbval-documentation-ejb.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.mbval-documentation-ejb.jar
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ejb.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ejb.jar
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ui.war".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.GazelleHL7v2Validator-ui.war
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.jboss-seam-2.3.1.Final.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.jboss-seam-2.3.1.Final.jar
          service jboss.module.service."deployment.GazelleHL7v2Validator-ear-3.7.4.ear.gazelle-seam-tools-jar.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator-ear-3.7.4.ear.gazelle-seam-tools-jar.jar
    WFLYCTL0448: 1 additional services are down due to their dependencies being missing or failed
    

    As you can see, my deployment of Gazelle's validator isn't yet ready for prime time. If this subject interests, you may pursue this work by going to my Gazelle validator notes.