Caused by: java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection
OK. So whatever Tomcat is doing under the hood its giving you a proxy object. Given how connection pooling works this is not surprising. The fact that it cannot be cast to org.postgresql.PGConnection is likewise unsurprising. You are dealing with composition, not extension.
java.sql.SQLException: Cannot unwrap to org.postgresql.PGConnection
No help here. This isn't technically the correct list for problems about Tomcat classes though hopefully enough people on here actually use this stuff and can provide meaningful help. Having not encountered this before I am not one of those people.
I am confused how you call unwrap(Connection.class) and get an exception naming org.postgresql.PGConnection explicitly....