Open swagataroy opened 3 years ago
Here is the StackTrace when the default application.yml (provide inside Spring Music) is used
2021-02-24T21:19:54.28+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.281 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration'
2021-02-24T21:19:54.28+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.287 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'taskExecutorBuilder'
2021-02-24T21:19:54.29+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.290 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties'
2021-02-24T21:19:54.29+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.295 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'taskExecutorBuilder' via factory method to bean named 'spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties'
2021-02-24T21:19:54.30+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.304 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'applicationTaskExecutor' via factory method to bean named 'taskExecutorBuilder'
2021-02-24T21:19:54.31+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.312 INFO 23 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-02-24T21:19:54.31+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.313 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactoryBootstrapExecutorCustomizer' via factory method to bean named 'applicationTaskExecutor'
2021-02-24T21:19:54.31+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.316 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'entityManagerFactoryBuilder'
2021-02-24T21:19:54.33+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.330 DEBUG 23 --- [ main] o.s.jdbc.datasource.DataSourceUtils : Fetching JDBC Connection from DataSource
2021-02-24T21:19:54.34+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.339 INFO 23 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-02-24T21:19:54.59+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:54.598 DEBUG 23 --- [ main] o.p.core.v3.ConnectionFactoryImpl : Trying to establish a protocol version 3 connection to localhost:5432
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:55.623 ERROR 23 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:303) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.Driver.makeConnection(Driver.java:465) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.Driver.connect(Driver.java:264) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.5.jar:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158) ~[spring-jdbc-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116) ~[spring-jdbc-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79) ~[spring-jdbc-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:330) ~[spring-jdbc-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.isEmbedded(EmbeddedDatabaseConnection.java:182) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateDefaultDdlAutoProvider.getDefaultDdlAuto(HibernateDefaultDdlAutoProvider.java:42) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.lambda$getVendorProperties$1(HibernateJpaConfiguration.java:130) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings.getDdlAuto(HibernateSettings.java:41) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineDdlAuto(HibernateProperties.java:136) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.getAdditionalProperties(HibernateProperties.java:102) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineHibernateProperties(HibernateProperties.java:94) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.getVendorProperties(HibernateJpaConfiguration.java:132) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:134) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1161) ~[spring-context-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.1.jar:5.3.1]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar:2.4.0]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.cloudfoundry.samples.music.Application.main(Application.java:16) ~[classes/:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app/:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[app/:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app/:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[app/:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT Caused by: java.net.ConnectException: Connection refused (Connection refused)
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.SocksSocketImpl.connect(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at java.base/java.net.Socket.connect(Unknown Source) ~[na:na]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.PGStream.createSocket(PGStream.java:231) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.PGStream.<init>(PGStream.java:95) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:98) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213) ~[postgresql-42.2.18.jar:42.2.18]
2021-02-24T21:19:55.62+0000 [APP/PROC/WEB/0] OUT ... 56 common frames omitted
2021-02-24T21:19:55.66+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:55.667 DEBUG 23 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2021-02-24T21:19:55.69+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:55.692 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'application'
2021-02-24T21:19:55.69+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:55.693 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'albumController'
2021-02-24T21:19:55.69+0000 [APP/PROC/WEB/0] OUT 2021-02-24 21:19:55.695 DEBUG 23 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'jpaAlbumRepository'
2021-02-24T21:19:55.70+0000 [APP/PROC/WEB/0] OUT 2021-0
I think this logic is broken and needs to be changed - https://github.com/pivotal-cf/java-cfenv/blob/master/java-cfenv-jdbc/src/main/java/io/pivotal/cfenv/jdbc/PostgresqlJdbcUrlCreator.java#L49
cfenv is expecting this syntax. There is no jdbc in the path for postgres bindings..
url: jdbc:postgresql://${vcap.services.swagata.credentials.db_host}:${vcap.services.swagata.credentials.db_port}/${vcap.services.swagata.credentials.db_name}
@swagataroy Hi Swagata, do you know whether this issue was resolved with the linked commit, included in v2.4.0?
I'm running into this issue as well on GCP using the GCP Service Broker (i.e. old one). I think the easiest fix would be to include existsByTagIgnoreCase with "postgres".
VCAP_SERVICES: {
"google-cloudsql-postgres": [
{
"credentials": {
"CaCert": "REDACTED",
"ClientCert": "REDACTED",
"ClientKey": "REDACTED",
"UriPrefix": "jdbc:",
"Username": "REDACTED",
"Password": "REDACTED",
"instance_name": "INSTANCE_NAME",
"uri": "jdbc:postgres://REDACTED:REDACTED%3D@REDACTED/INSTANCE_NAME?sslmode=require&sslcert=REDACTED&sslkey=REDACTED&sslrootcert=REDACTED"
},
"label": "google-cloudsql-postgres",
"tags": [
"gcp",
"cloudsql",
"postgres"
]
}
]
}
cfenv doesn’t seem to be working with Postgres. I noticed here in the change to “Add support for postgresql”
I think it expects this URI https://github.com/pivotal-cf/java-cfenv/blob/master/java-cfenv-jdbc/src/main/java/io/pivotal/cfenv/jdbc/PostgresqlJdbcUrlCreator.java#L49
Having the following in the application.properties doesn’t work / / The default spring-music settings. This does work for mysql though. The auto-configure doesn't work for Postgres like the way it works for Postgres
Changing the application.properties to the following works -
Here is the cf env output cf env spring-music