Jmix - upgrading postgres from 13 to 14 - Exception while initializing Database connection java.sql.SQLException: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)

Hi,
I have been recently tasked with upgrading the my application developed in CUBA framework with Postgres 13 as backend and trying to upgrade postgres version to 14.
I have been struggling to find out is causing the to connect postgres database.
Here is my full exception with stack trace.

22:25:05.166 ERROR c.h.b.c.e.c.ExtSpringProcessEngineConfiguration- Exception while initializing Database connection
java.sql.SQLException: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:653) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:532) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:731) ~[tomcat-dbcp.jar:9.0.65]
        at com.haulmont.cuba.core.sys.jdbc.ProxyDataSource.getConnection(ProxyDataSource.java:35) ~[cuba-core-7.2.10.jar:7.2.10]
        at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158) ~[spring-jdbc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116) ~[spring-jdbc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:226) ~[spring-jdbc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at com.sun.proxy.$Proxy422.getMetaData(Unknown Source) ~[na:na]
        at com.haulmont.bpm.core.engine.cfg.ExtSpringProcessEngineConfiguration.initDatabaseType(ExtSpringProcessEngineConfiguration.java:70) ~[bpm-core-7.2.10.jar:7.2.10]
        at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:786) [activiti-engine-5.20.0.jar:5.20.0]
        at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:602) [activiti-engine-5.20.0.jar:5.20.0]
        at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:590) [activiti-engine-5.20.0.jar:5.20.0]
        at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:65) [activiti-spring-5.20.0.jar:5.20.0]
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:60) [activiti-spring-5.20.0.jar:5.20.0]
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32) [activiti-spring-5.20.0.jar:5.20.0]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1828) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1265) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:408) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at com.haulmont.cuba.core.sys.CubaDefaultListableBeanFactory.resolveDependency(CubaDefaultListableBeanFactory.java:59) ~[cuba-global-7.2.10.jar:7.2.10]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.afterPropertiesSet(AbstractRefreshableConfigApplicationContext.java:154) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at com.haulmont.cuba.core.sys.CubaClassPathXmlApplicationContext.<init>(CubaClassPathXmlApplicationContext.java:42) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.CubaCoreApplicationContext.<init>(CubaCoreApplicationContext.java:32) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:125) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:43) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:65) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:86) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AppContextLoader.contextInitialized(AppContextLoader.java:52) ~[cuba-core-7.2.10.jar:7.2.10]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911) ~[catalina.jar:9.0.65]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_342]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_342]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.65]
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) ~[na:1.8.0_342]
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:825) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) ~[catalina.jar:9.0.65]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_342]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.65]
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) ~[na:1.8.0_342]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) ~[catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.65]
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772) ~[catalina.jar:9.0.65]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_342]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_342]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_342]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_342]
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) ~[bootstrap.jar:9.0.65]
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) ~[bootstrap.jar:9.0.65]
Caused by: java.sql.SQLException: validationQuery didn't return a row
        at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:398) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:744) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:114) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:649) ~[tomcat-dbcp.jar:9.0.65]
        ... 95 common frames omitted
22:25:05.991 INFO  o.a.engine.impl.ProcessEngineImpl       - ProcessEngine default created
22:25:06.525 INFO  c.h.c.c.s.CubaThreadPoolTaskScheduler   - Initializing ExecutorService 'restapi_scheduler'
22:25:08.611 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [app-core.cuba:type=PersistenceManager, app-core.cuba:type=ConfigStorage, app-core.cuba:type=UserSessions, app-core.cuba:type=UniqueNumbers, app-core.cuba:type=Emailer, app-core.cuba:type=EntityLog, app-core.cuba:type=FileStorage, app-core.cuba:type=LockManager, app-core.cuba:type=CachingFacade, app-core.cuba:type=ClusterManager, app-core.cuba:type=ScriptingManager, app-core.cuba:type=ServerInfo, app-core.cuba:type=Scheduling, app-core.cuba:type=PasswordEncryptionSupport, app-core.cuba:type=JmxNodeIdentifier, app-core.cuba:type=JmxLogControl, app-core.cuba:type=ClassLoaderManager, app-core.cuba:type=StatisticsCounter, app-core.cuba:type=BruteForceProtection, app-core.cuba:type=QueryCacheSupport]
22:25:08.798 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [app-core.reports:type=CubaOfficeIntegration, app-core.reports:type=ReportImportExport, app-core.reports:type=ReportingMigrator]
22:25:08.812 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [app-core.fts:type=FtsManager, app-core.fts:type=QueryCacheStats]
22:25:08.825 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [app-core.bpm:type=MessagesCache]
22:25:08.830 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [app-core.restapi:type=ServerTokenStore]
22:25:08.859 INFO  c.h.cuba.core.sys.MetadataImpl          - Initializing metadata
22:25:09.029 WARN  c.h.cuba.core.sys.MetaModelLoader       - Class de.diedavids.cuba.entitysoftreference.EntitySoftReferenceConverter is not loaded into metadata
22:25:09.029 WARN  c.h.cuba.core.sys.MetaModelLoader       - Class de.diedavids.cuba.entitysoftreference.EntitySoftReferenceConverter is not loaded into metadata
22:25:09.423 INFO  c.h.cuba.core.sys.MetadataImpl          - Metadata initialized in 563 ms
22:25:09.761 ERROR c.h.c.c.s.AbstractWebAppContextLoader   - Error initializing application
java.lang.RuntimeException: 
=======================================================================================
ERROR: Cannot check and update data store [Main]. See the stacktrace below for details.
=======================================================================================
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdateManager.updateDatabase(DbUpdateManager.java:78) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdateManager.applicationInitialized(DbUpdateManager.java:61) ~[cuba-core-7.2.10.jar:7.2.10]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_342]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_342]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_342]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_342]
        at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:305) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:190) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:153) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at com.haulmont.cuba.core.sys.EventsImpl.publish(EventsImpl.java:33) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:69) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:86) ~[cuba-global-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.AppContextLoader.contextInitialized(AppContextLoader.java:52) [cuba-core-7.2.10.jar:7.2.10]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) [catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911) [catalina.jar:9.0.65]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_342]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_342]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.65]
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) [na:1.8.0_342]
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:825) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) [catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) [catalina.jar:9.0.65]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) [catalina.jar:9.0.65]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_342]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.65]
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_342]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) [catalina.jar:9.0.65]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772) [catalina.jar:9.0.65]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_342]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_342]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_342]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_342]
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) [bootstrap.jar:9.0.65]
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) [bootstrap.jar:9.0.65]
Caused by: com.haulmont.cuba.core.sys.DbInitializationException: Error connecting to data store [Main]: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.dbInitialized(DbUpdaterEngine.java:210) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.updateDatabase(DbUpdaterEngine.java:101) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdateManager.updateDatabase(DbUpdateManager.java:76) ~[cuba-core-7.2.10.jar:7.2.10]
        ... 58 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:653) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:532) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:731) ~[tomcat-dbcp.jar:9.0.65]
        at com.haulmont.cuba.core.sys.jdbc.ProxyDataSource.getConnection(ProxyDataSource.java:35) ~[cuba-core-7.2.10.jar:7.2.10]
        at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.dbInitialized(DbUpdaterEngine.java:189) ~[cuba-core-7.2.10.jar:7.2.10]
        ... 60 common frames omitted
Caused by: java.sql.SQLException: validationQuery didn't return a row
        at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:398) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:744) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:114) ~[tomcat-dbcp.jar:9.0.65]
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:649) ~[tomcat-dbcp.jar:9.0.65]
        ... 64 common frames omitted
22:25:09.766 INFO  c.h.c.c.s.CubaThreadPoolTaskScheduler   - Shutting down ExecutorService 'restapi_scheduler'
22:25:09.789 INFO  c.h.c.c.s.CubaThreadPoolTaskScheduler   - Shutting down ExecutorService 'scheduler'
22:25:09.841 INFO  c.h.c.c.sys.remoting.RemotingServlet    - Initializing Servlet 'remoting'
22:25:09.846 ERROR c.h.c.c.sys.remoting.RemotingServlet    - Context initialization failed
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Any ideas whats causing for this error?

Hi,
Maybe it means what it means - that Postgres server isn’t healthy, because it isn’t returning an expected answer for the validation query ?

The validationQuery is set in the datasource settings, near to the URL, login and password.
This setting isn’t set by default by CUBA, someone has specified it explicitly in your environment.

Look here for what validationQuery is: Apache Tomcat 7 (7.0.109) - The Tomcat JDBC Connection Pool