Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections
There are superuser_reserved_connections
connections slots (3 by default) that are reserved for superusers so that they can connect even in a situation where all connection slots are taken.
So you effectively only have 297 slots available.
Either reduce the maximum number of connections of your connection pool or increase max_connections
in PostgreSQL.
By the way, 300 is much too high. You should use a much lower setting with a connection pool (unless you have hundreds of cores in your database machine).