org.postgresql.util.PSQLException: Connection to xx.xxx.x.xx:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
"FATAL: could not load pg_hba.conf
LOG: database system is shut down
VMware Cloud Director
The issue was caused by IP addresses listed under the "IPv4 local connections" section of pg_hba.conf file that were not setup with a proper subnet, causing Postgres to shutdown and stop working.
To help solving the issue, we need to make sure that the ip addresses placed in the pg_hba.conf file contain an IP address with a valid subnet.
Please refer this document for more information - Configure External Access to the VMware Cloud Director Database