Gazelle validator notes

Russell Bateman
16 February 2022
last update:




The instructions for setting up Gazelle are here: Gazelle Framework documentation: Gazelle HL7 Validator. Step by step, this entails:

  1. Java 8 (at least).

    In order to stand up WildFly for deploying GazelleHL7v2Validator-ear-3.7.4.ear, I needed Java 11. See JBoss WildFly notes.

  2. PostgreSQL, version 9 or later.

    Elsewhere, I installed WildFly for a local, stand-alone deployment of the Gazelle validator. Wildfly installed and running, and the Gazelle EAR file dropped into it for deployment, it crashed because

    
    Caused by: org.jboss.modules.ModuleNotFoundException: org.postgresql
    	at org.jboss.modules.Module.addExportedPaths(Module.java:1410)
    	at org.jboss.modules.Module.addPaths(Module.java:1288)
    	at org.jboss.modules.Module.link(Module.java:1615)
    	at org.jboss.modules.Module.relinkIfNecessary(Module.java:1643)
    	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:303)
    	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:287)
    	at [email protected]//org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:93)
    	... 8 more
    

    ...PostgreSQL is missing on my installation host. See PostgreSQL notes for installation. This installs PostgreSQL as a systemd service. I also set a password and fixed /etc/postgresql/12/main/pg_hba.conf to let me in as discussed in those notes.

    russ@tirion ~ $ systemctl status postgresql
     postgresql.service - PostgreSQL RDBMS
         Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
         Active: active (exited) since Wed 2022-02-23 09:04:21 MST; 8s ago
        Process: 630898 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 630898 (code=exited, status=0/SUCCESS)
    
    Feb 23 09:04:21 tirion systemd[1]: Starting PostgreSQL RDBMS...
    Feb 23 09:04:21 tirion systemd[1]: Finished PostgreSQL RDBMS.
    

    The Gazelle instructions want me to set up a database in PostgreSQL. First, let's peek under the covers to see where the createdb command comes from, then use the command:

    russ@tirion ~ $ which createdb
    /usr/bin/createdb
    russ@tirion ~ $ ll /usr/bin/createdb
    lrwxrwxrwx 1 root root 37 Aug 24  2020 /usr/bin/createdb -> ../share/postgresql-common/pg_wrapper
    
  3. A user, gazelle, on your host. This is for PostgreSQL.
    russ@tirion ~ $ sudo useradd gazelle
    russ@tirion ~ $ sudo cat /etc/passwd | grep gazelle
    gazelle:x:1002:1003::/home/gazelle:/bin/sh
    

    Also, add this user to PostgreSQL.

    russ@tirion ~ $ sudo su - postgres
    postgres@tirion:~$ createuser --interactive --pwprompt
    Enter name of role to add: gazelle
    Enter password for new role: gazelle
    Enter it again: gazelle
    Shall the new role be a superuser? (y/n) n
    Shall the new role be allowed to create databases? (y/n) y
    Shall the new role be allowed to create more new roles? (y/n) n
    postgres@tirion:~$ logout
    russ@tirion ~ $ psql -U postgres
    psql (12.9 (Ubuntu 12.9-0ubuntu0.20.04.1))
    Type "help" for help.
    postgres=# \du
                                       List of roles
     Role name |                         Attributes                         | Member of
    -----------+------------------------------------------------------------+-----------
     gazelle   | Create DB                                                  | {}
     postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
    postgres=# \q
    
  4. Re-copy the Gazelle EAR file to JBoss/WildFly.

    First, let's tail -f the WildFly log:

    root@tirion:/opt/wildfly/standalone/log# tail -f server.log
    

    We have to rename the EAR because I didn't do it the first time I tried. We'll do that at the same time as we deploy it again:

    russ@tirion ~/Downloads/gazelle $ sudo cp GazelleHL7v2Validator-ear-3.7.4.ear /opt/wildfly/standalone/deployments/GazelleHL7v2Validator.ear
    

    Here's what the log tells us:

    2022-02-23 10:05:56,826 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "GazelleHL7v2Validator.ear" (runtime-name: "GazelleHL7v2Validator.ear")
    2022-02-23 10:05:59,927 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb-api.jar in /content/GazelleHL7v2Validator.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    2022-02-23 10:05:59,927 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry activation.jar in /content/GazelleHL7v2Validator.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    2022-02-23 10:05:59,927 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jsr173_1.0_api.jar in /content/GazelleHL7v2Validator.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    2022-02-23 10:05:59,927 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb1-impl.jar in /content/GazelleHL7v2Validator.ear/lib/jaxb-impl-2.2.5.jboss-1.jar  does not point to a valid jar for a Class-Path reference.
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0207: Starting subdeployment (runtime-name: "gazelle-seam-tools-jar.jar")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0207: Starting subdeployment (runtime-name: "gazelle-gdpr-ejb-1.2.jar")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0207: Starting subdeployment (runtime-name: "GazelleHL7v2Validator-ui.war")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0207: Starting subdeployment (runtime-name: "version-1.0.3.jar")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0207: Starting subdeployment (runtime-name: "mbval-documentation-ejb.jar")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0207: Starting subdeployment (runtime-name: "jboss-seam-2.3.1.Final.jar")
    2022-02-23 10:05:59,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "GazelleHL7v2Validator-ejb.jar")
    2022-02-23 10:06:00,119 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for GazelleHL7v2Validator-PersistenceUnit
    2022-02-23 10:06:00,280 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.module.service."deployment.GazelleHL7v2Validator.ear.gazelle-seam-tools-jar.jar".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.GazelleHL7v2Validator.ear.gazelle-seam-tools-jar.jar".main: WFLYSRV0179: Failed to load module: deployment.GazelleHL7v2Validator.ear.gazelle-seam-tools-jar.jar
    .
    .
    .
    Caused by: org.jboss.modules.ModuleNotFoundException: org.postgresql
    	at org.jboss.modules.Module.addExportedPaths(Module.java:1410)
    	at org.jboss.modules.Module.addPaths(Module.java:1288)
    	at org.jboss.modules.Module.link(Module.java:1615)
    	at org.jboss.modules.Module.relinkIfNecessary(Module.java:1643)
    	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:303)
    	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:287)
    	at [email protected]//org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:93)
    	... 8 more
    

    Hmmm... Gazelle still won't deploy and the error still seems to be the ModuleNotFoundException, as if PostgreSQL isn't there.

Free-form notes as I try to get this working...

https://www.stenusys.com/how_to_setup_postgresql_datasource_with_wildfly/ Let's try Option #3 Using WildFly CLI.

Remember that we changed the management-http port from its default, 9990, to 4440. From PostgreSQL JDBC Driver, we downloaded postgresql-42.3.3.jar to ~/Downloads.

This appears to be a way to connect to PostgreSQL and hand it components to install.

root@tirion:/opt/wildfly/bin# ./jboss-cli.sh --connect controller=127.0.0.1:4440
[[email protected]:4440 /] module add --name=org.postgresql --resources=/home/russ/Downloads/postgresql-42.3.3.jar --dependencies=javax.api,javax.transaction.api
[[email protected]:4440 /] /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgresql",driver-class-name=org.postgresql.Driver)
{"outcome" => "success"}
[[email protected]:4440 /] data-source add --jndi-name=java:jboss/datasources/StenusysDemoDS --name=StenusysDemoDS --connection-url=jdbc:postgresql://localhost:5432/StenusysDemo --driver-name=postgres --user-name=postgres --password=admin

Oops. I was blindly following an example. No, of course I don't want the command just above. I removed it thus:
[[email protected]:4440 /] data-source remove --name=StenusysDemoDS

# Create the Gazelle database:
1. Add gazelle user to /etc/postgresql/12/main/pg_hba.conf in like manner to user postgres with trust
2. Restart PostgreSQL.
3. sudo createdb -U gazelle -E UTF8 gazelle-hl7-validator
3. List databases:
postgres=# \l
                                        List of databases
         Name          |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------------------+----------+----------+-------------+-------------+-----------------------
 gazelle-hl7-validator | gazelle  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres              | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0             | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                       |          |          |             |             | postgres=CTc/postgres
 template1             | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                       |          |          |             |             | postgres=CTc/postgres
(4 rows)


Let's try again...

Now, restarting WildFly leads to a less-scary list of missing services:

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:Maxet...

=========================================================================
.
.
.
12:32:49,336 INFO  [org.jboss.as.webservices] (MSC service thread 1-5) WFLYWS0003: Starting service jboss.ws.endpoint."GazelleHL7v2Validator.ear"."GazelleHL7v2Validator-ejb.jar".GazelleHL7v2ValidationGITBWS
12:32:49,353 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "GazelleHL7v2Validator.ear")]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.GazelleHL7v2ValidatorDS"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.persistenceunit.\"GazelleHL7v2Validator.ear/GazelleHL7v2Validator-ejb.jar#GazelleHL7v2Validator-PersistenceUnit\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.GazelleHL7v2ValidatorDS]",
        "jboss.persistenceunit.\"GazelleHL7v2Validator.ear/GazelleHL7v2Validator-ejb.jar#GazelleHL7v2Validator-PersistenceUnit\" is missing [jboss.naming.context.java.jboss.datasources.GazelleHL7v2ValidatorDS]"
    ]
}
.
.
.
12:32:49,388 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 45) WFLYSRV0010: Deployed "GazelleHL7v2Validator.ear" (runtime-name : "GazelleHL7v2Validator.ear")
12:32:49,389 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
    service jboss.naming.context.java.jboss.datasources.GazelleHL7v2ValidatorDS (missing) dependents:
    [
      service jboss.persistenceunit."GazelleHL7v2Validator.ear/GazelleHL7v2Validator-ejb.jar#GazelleHL7v2Validator-PersistenceUnit",
      service jboss.persistenceunit."GazelleHL7v2Validator.ear/GazelleHL7v2Validator-ejb.jar#GazelleHL7v2Validator-PersistenceUnit".__FIRST_PHASE__
    ]
WFLYCTL0448: 69 additional services are down due to their dependencies being missing or failed
12:32:49,417 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
12:32:49,421 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 26.0.1.Final (WildFly Core 18.0.4.Final) started (with errors) in 7921ms - Started 1009 of 1288 services (96 services failed or missing dependencies, 363 services are lazy, passive or on-demand)
12:32:49,422 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:4440/management
12:32:49,422 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:4440