{"id":18111056,"url":"https://github.com/blandger/air-port-example-j2ee","last_synced_at":"2026-05-10T06:45:50.769Z","repository":{"id":231273635,"uuid":"781326870","full_name":"blandger/air-port-example-j2ee","owner":"blandger","description":"Jakarta JEE rest api web app example using JPA, DI, PostgreSQL in docker compose, jwt, WildFly app server","archived":false,"fork":false,"pushed_at":"2024-04-19T09:56:52.000Z","size":1160,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T13:27:50.175Z","etag":null,"topics":["criteria-api","docker-compose","jee","jpa","jwt-authentication","postgresql","wildfly"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blandger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-03T07:09:15.000Z","updated_at":"2024-04-21T08:34:31.000Z","dependencies_parsed_at":"2024-04-19T10:57:24.131Z","dependency_job_id":"296c5532-629b-449a-99c4-8ced2d4de829","html_url":"https://github.com/blandger/air-port-example-j2ee","commit_stats":null,"previous_names":["blandger/air-port-example","blandger/air-port-example-j2ee"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blandger%2Fair-port-example-j2ee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blandger%2Fair-port-example-j2ee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blandger%2Fair-port-example-j2ee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blandger%2Fair-port-example-j2ee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blandger","download_url":"https://codeload.github.com/blandger/air-port-example-j2ee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451626,"owners_count":20940946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["criteria-api","docker-compose","jee","jpa","jwt-authentication","postgresql","wildfly"],"created_at":"2024-11-01T00:12:56.266Z","updated_at":"2026-05-10T06:45:45.738Z","avatar_url":"https://github.com/blandger.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## AirPort j2ee example\n\nThe `Air port` is an example Jakarta EE application with a HTTP endpoint that is running in\n[WildFly j2ee container](https://wildfly.org).\n\nThe `src/main` folder contains a Jakarta EE application using JAX-RS.\n\n# Prerequisite installation\n\n### Install JDK 17 and check\nUse any suitable approach to install JDK 17. Then check it using command below\n\n\u003ejava --version\n\nThe output should be something like :\n\n```\nopenjdk 17.0.9 2023-10-17\nOpenJDK Runtime Environment GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22)\nOpenJDK 64-Bit Server VM GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22, mixed mode, sharing)\n```\n\n## Docker + docker compose\n\n### Install Docker + docker compose tools into your system\nSee how to install it [from Docker guide/doc](https://docs.docker.com/engine/install/)\n\n### Run and Check PostgreSQL docker-compose server\n\nWhen you have Docker compose properly installed there is a prepared script in project root folder: docker-compose.yml\n\n\u003e sudo docker compose up\n\nOR\n\n\u003e docker compose up\n\nYou can see PostgreSQL running in docker compose. \n```\n............................\npostgres-1  | PostgreSQL init process complete; ready for start up.\npostgres-1  |\npostgres-1  | 2024-04-04 10:18:24.519 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit\npostgres-1  | 2024-04-04 10:18:24.519 UTC [1] LOG:  listening on IPv4 address \"0.0.0.0\", port 5432\npostgres-1  | 2024-04-04 10:18:24.519 UTC [1] LOG:  listening on IPv6 address \"::\", port 5432\npostgres-1  | 2024-04-04 10:18:24.531 UTC [1] LOG:  listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\npostgres-1  | 2024-04-04 10:18:24.545 UTC [61] LOG:  database system was shut down at 2024-04-04 10:18:24 UTC\npostgres-1  | 2024-04-04 10:18:24.554 UTC [1] LOG:  database system is ready to accept connections\n```\n\n### Install PostgreSQL CLI client\nLinux: Check how to install PSQL CLI client only by [link](https://www.dewanahmed.com/install-psql/)\n\nWindows: Download 16.2 installation package, install PSQL CLI client only by [link](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads)\n\nCheck after installation\n\n\u003epsql --version\n```\npsql (PostgreSQL) 14.11 (Ubuntu 14.11-0ubuntu0.22.04.1)\n```\n\nCheck SQL connection using command:\n\u003e psql postgres://postgres:example@localhost:5432\n\nPossible output should be like :\n```\npsql (14.11 (Ubuntu 14.11-0ubuntu0.22.04.1), server 16.2 (Debian 16.2-1.pgdg120+2))\nWARNING: psql major version 14, server major version 16.\nSome psql features might not work.\nType \"help\" for help.\n\npostgres=#\n```\n### Create database (IMPORTANT !)\nWe'll create a new database (air_port_example) MANUALLY and new schema (air_port_schema) with all tables and initial data will be created AUTOMATICALLY on startup.\n\nRun command in CLI to create new db schema\n\u003e postgres=# SELECT 'CREATE DATABASE air_port_example' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'air_port_example')\\gexec\n\nSometimes more simple form can work too (not always):\n\u003e postgres=# CREATE DATABASE air_port_example;\n\nyou can show SQL schema list by command inside SQL server like:\n\n\u003e postgres=#\\l\n\n```\n                                                          List of databases\n       Name       |  Owner   | Encoding | Locale Provider |  Collate   |   Ctype    | ICU Locale | ICU Rules |   Access privileges\n------------------+----------+----------+-----------------+------------+------------+------------+-----------+-----------------------\n air_port_example | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           |\n postgres         | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           |\n template0        | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           | =c/postgres          +\n                  |          |          |                 |            |            |            |           | postgres=CTc/postgres\n```\nExit SQL client by:\n\n\u003epostgres=#\\q\n\n## WildFly application server\n\n### Download and unpack WildFly application server\nDownload ZIP/TGZ **31.0.0.Final** version ONLY from [the download page](https://www.wildfly.org/downloads/)\nor by direct link:\n\n[https://github.com/wildfly/wildfly/releases/download/31.0.0.Final/wildfly-31.0.0.Final.zip](https://github.com/wildfly/wildfly/releases/download/31.0.0.Final/wildfly-31.0.0.Final.zip)\n\nunpack it into local folder like : /wildfly-31.0.0.Final/\n\n### Check WildFly can start up without errors\n\nwildfly-31.0.0.Final/\u003e ./bin/standalone.sh\n\nSee output like\n```\n.................\n15:08:59,361 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server\n15:08:59,364 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management\n15:08:59,364 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990\n15:08:59,365 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 31.0.0.Final (WildFly Core 23.0.1.Final) started in 3481ms - Started 569 of 790 services (335 services are lazy, passive or on-demand) - Server configuration file in use: standalone.xml\n```\n\n## PosgreSQL driver installation into WildFly server\n\nDriver library should be installed into running WildFly container using JBoss Admin CLI tool\n\n### 1. Open terminal and run WildFly server by command :\n\u003e ./wildfly-31.0.0.Final/bin/standalone.sh\n\ncheck it's started correctly.\n\n### 2. Open second terminal and run Admin CLI tool by:\n\u003e ./wildfly-31.0.0.Final/bin/jboss.cli\n\nSee output from the CLI like :\n```\nYou are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.\n[disconnected /]\n```\ntype and run next command inside CLI to connect to running WildFly:\n\n\u003e [disconnected /] connect\n\nSee no errors on connect.\n\n### 3. Run command to install new module/driver JAR file like:\n\nSpecify correct local path to postgresql-42.7.3.jar file from project:\n/air-port-example/lib/postgresql-42.7.3.jar\n\n\u003e [standalone@localhost:9990 /] module add --name=org.postgres --resources=path_to/air-port-example/lib/postgresql-42.7.3.jar --dependencies=javax.api,javax.transaction.api\n\nIf you put 'postgresql-42.7.3.jar' inside /wildfly-31.0.0.Final/bin \n\n\u003e [standalone@localhost:9990 /] module add --name=org.postgres --resources=postgresql-42.7.3.jar --dependencies=javax.api,javax.transaction.api\n\nCheck and see no errors in CLI\n\nType to quit:\n\u003e [standalone@localhost:9990 /] quit\n\n### 4. Restart (stop and start again) WildFly server\n\n\u003e wildfly-31.0.0.Final/bin/standalone.sh\n\nWatch there are no errors during start up after adding new module\n\n\n### Replace XML config file in WildFly app server (31.0.0.Final)\n**_IMPORTANT! Backup (rename) original WildFly config file in folder :_**\n/wildfly-31.0.0.Final/standalone/configuration/standalone.xml\n\nTake updated config with additional PostgreSQL datasource from project folder :\n/air-port-example/wildfly_config/standalone.xml\n\nput it into wildfly install folder (standalone/configuration/standalone.xml), then check again running by command:\n\n\u003e /wildfly-31.0.0.Final/bin/standalone.sh\n\nSee output about bound **airPortExampleDS** data source:\n\n```\n16:24:29,245 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443\n16:24:29,251 INFO  [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: Jakarta Enterprise Beans subsystem suspension complete\n16:24:29,281 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/airPortExampleDS]\n```\n\nCheck there is no errors like:\n```\nCaused by: org.postgresql.util.PSQLException: FATAL: database \"air_port_example\" does not exist\n```\n\n## Install MAVEN build tool and check\nUse any suitable approach to install Maven. Version 3.6.4 was used. Then check it using command below\n\n\u003emvn --version\n\nThe output should be something like :\n```\nApache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)\nMaven home: /opt/maven\nJava version: 17.0.9, vendor: GraalVM Community, runtime: /home/username/.sdkman/candidates/java/17.0.9-graalce\nDefault locale: en_US, platform encoding: UTF-8\nOS name: \"linux\", version: \"5.15.0-101-generic\", arch: \"amd64\", family: \"unix\"\n```\n\n## Building the application\nTo build the application, you use Maven:\n\n\u003e mvn clean package\n\nMaven will compile the application, provision a WildFly server\nThe WildFly server is created in `target/server` with the application deployed in it.\n\n## Deploying application into running WildFly app server\n\nYou should run WildFly first by command (server is running on deploy):\n\n\u003e/wildfly-31.0.0.Final/bin/standalone.sh\n\nthen run sources build and deploy command\n\n\u003e mvn clean package wildfly:deploy\n\nCorrect WAR app deployment logs without errors looks like below: \n```\n15:04:05,077 INFO  [org.wildfly.security.soteria.original.SamRegistrationInstaller] (ServerService Thread Pool -- 83) Initializing Soteria 3.0.3.Final for context '/airport-example'\n15:04:05,428 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 83) RESTEASY002225: Deploying jakarta.ws.rs.core.Application: class org.airport.example.AirPortApplication\n15:04:05,732 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 83) WFLYUT0021: Registered web context: '/airport-example' for server 'default-server'\n15:04:05,784 INFO  [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0010: Deployed \"airport-example.war\" (runtime-name : \"airport-example.war\")\n```\n\nIF you see error like below, then you probably didn't run/start WildFly instance properly\n```\n[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:4.2.1.Final:deploy (default-cli) \non project airport-example: Failed to execute goal deploy.: \njava.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. \nThe connection failed: Connection refused -\u003e [Help 1]\n```\n\n## Testing REST API\nYou can use a Postman.com account for importing Environment and Collection [placed into folder](/wildfly_config/Postman.com_test_calls_exported)\n\nDeployed application API is accessible by URL: http://127.0.0.1:8080/airport-example\n\nAll api use - Content-Type: application/json\n\n### User endPoints\n\nPOST\n/users/register\n```\n{\"username\":\"user family name FIFO\",\"email\":\"test_user_01@gmail.com\",\"password\":\"jwt#$%ge\"}\n```\n\nPOST\n/users/login\n```\n{\"email\":\"admin@gmail.com\",\"password\":\"Dfks$5d*Q\"}\n```\n\nPOST\n/users/logout\nHeader = Authorization: Bearer eyJraWQiOi......\n\n### AirPort endpoints\n\nPOST\n/airports\n```\nHeader = Authorization: Bearer eyJraWQiOi......\n{\"name\":\"New AirPort name\",\"code\":\"OIWW\",\"city\":\"New City name\"}\n```\n\nPUT\n/airports/{id}\n```\nHeader = Authorization: Bearer eyJraWQiOi......\n{\"name\":\"New AirPort 22\",\"code\":\"YJDEW\",\"city\":\"New City 22\"}\n```\n\nDELETE\n/airports/{id}\n```\nHeader = Authorization: Bearer eyJraWQiOi......\n```\n\nGET\n/airports\n\nGET\n/airports?name=Ne\n\nGET\n/airports?code=O\n\nGET\n/airports?name=Ne\u0026code=O\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblandger%2Fair-port-example-j2ee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblandger%2Fair-port-example-j2ee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblandger%2Fair-port-example-j2ee/lists"}