OpenNMS 27.0.0 provides the PostgreSQL JDBC driver in version 42.2.5. The latest one is right now 42.2.18.
Since 42.2.7 SCRAM authentication method was introduced in PostgreSQL, OpenNMS can't handle PostgreSQL monitoring right now. See here: https://opennms.discourse.group/t/attention-when-using-scram-in-postgresql
A driver upgrade within the OpenNMS installation would be required to solve the problem.