Reputation: 5926
I am new to Cloud Foundry and I have deployed local bosh-lite CF installation.
I have a Spring Boot with Hibernate JPA application which connects to postgresql which is again running locally which i want to deploy.
For this i created an user provided service for postgresql with service instance parameters of host,port,username and password.
Now i deployed the app and have bound the app to the service instance.
Now when i restart the app the app fails with some connection error (host name was wrong) to the db instance. I changed the service instance parameters using cfups command to update the host parameters. The command returned 0 as response.
Now i restage the application to let the changes take effect. But the app again fails with the same error pointing to the old host parameter.
It seems either the parameter changes did not take place using the cfups command or somehow the app is not getting restaged with the new parameters.
Another question how do i get to see the current service instance parameters of the already running service instance. ? cf service servicename only gives the name and the apps bound to it
UPDATE
I followed the tutorial here https://www.youtube.com/watch?v=g3DbtW5lwqY by Scott Frederick and went with the third option i.e. to configure by having spring boot cloud connector and postgresql driver in my classpath.
So in bullett points my scenario
Below is the output of my cf env app` . Host of service instance parameter "postgressql-service-instance1" is the ip of my host machine which has the postgresql isntalled. I am on a Vagrant based Virtual Box Ubuntu.
System-Provided:
{
"VCAP_SERVICES": {
"user-provided": [
{
"credentials": {
"host": "10.0.2.2",
"password": "admin",
"port": "5432",
"username": "postgres"
},
"label": "user-provided",
"name": "postgresql-service-instance1",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
}
]
}
}
{
"VCAP_APPLICATION": {
"application_id": "194af4c6-5bbc-4644-af04-55cdaff12b6d",
"application_name": "employeerest2",
"application_uris": [
"employeerest2.bosh-lite.com"
],
"application_version": "facfce7e-9436-4059-94e8-3139172fa482",
"cf_api": "https://api.bosh-lite.com",
"limits": {
"disk": 1024,
"fds": 16384,
"mem": 256
},
"name": "employeerest2",
"space_id": "9a8b306d-8509-4241-b1fc-3ecb652c0733",
"space_name": "development",
"uris": [
"employeerest2.bosh-lite.com"
],
"users": null,
"version": "facfce7e-9436-4059-94e8-3139172fa482"
}
}
No user-defined env variables have been set
No running env variables have been set
No staging env variables have been set
As you can see my app is bound to an service. But whenver i try to restart, restage the app i get the following error` Which clearly shows the connection is refused at localhost:5432. But i am not using localhost as a host service parameter to connect to.
I have configured my postgresql instance to accept connection from my guest OS. I don't know how Spring Boot is getting the host name as "localhost"
2017-06-01T21:51:55.74+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_131]
2017-06-01T21:51:55.75+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_131]
2017-06-01T21:51:55.75+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_131]
2017-06-01T21:51:55.75+0530 [App/0] OUT at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_131]
2017-06-01T21:51:55.75+0530 [App/0] OUT at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_131]
2017-06-01T21:51:55.75+0530 [App/0] OUT at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.75+0530 [App/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.75+0530 [App/0] OUT ... 53 common frames omitted
2017-06-01T21:51:55.75+0530 [App/0] OUT 2017-06-01 16:21:55.751 ERROR 29 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
2017-06-01T21:51:55.76+0530 [App/0] OUT 2017-06-01 16:21:55.760 WARN 29 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-06-01T21:51:55.76+0530 [App/0] OUT 2017-06-01 16:21:55.765 INFO 29 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-06-01T21:51:55.78+0530 [App/0] OUT 2017-06-01 16:21:55.789 INFO 29 --- [ main] utoConfigurationReportLoggingInitializer :
2017-06-01T21:51:55.78+0530 [App/0] OUT Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-06-01T21:51:55.79+0530 [App/0] OUT 2017-06-01 16:21:55.794 ERROR 29 --- [ main] o.s.boot.SpringApplication : Application startup failed
2017-06-01T21:51:55.79+0530 [App/0] OUT org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081) ~[spring-context-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856) ~[spring-context-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.saurav.cf.casestudy.employee.EmployeerestApplication.main(EmployeerestApplication.java:20) [classes/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) [app/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
2017-06-01T21:51:55.79+0530 [App/0] OUT ... 24 common frames omitted
2017-06-01T21:51:55.79+0530 [App/0] OUT Caused by: org.hibernate.exception.JDBCConnectionException: Unable to obtain JDBC Connection
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.schema.extract.internal.ExtractionContextImpl.getJdbcConnection(ExtractionContextImpl.java:65) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:40) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:64) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:60) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:80) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:475) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT ... 30 common frames omitted
2017-06-01T21:51:55.79+0530 [App/0] OUT Caused by: 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.
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:215) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.postgresql.Driver.makeConnection(Driver.java:404) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.postgresql.Driver.connect(Driver.java:272) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:482) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-8.5.14.jar!/:na]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT at org.hibernate.tool.schema.extract.internal.ExtractionContextImpl.getJdbcConnection(ExtractionContextImpl.java:62) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
2017-06-01T21:51:55.79+0530 [App/0] OUT ... 37 common frames omitted
2017-06-01T21:51:55.79+0530 [App/0] OUT Caused by: java.net.ConnectException: Connection refused (Connection refused)
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_131]
2017-06-01T21:51:55.79+0530 [App/0] OUT at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_131]
2017-06-01T21:51:55.80+0530 [App/0] OUT at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.80+0530 [App/0] OUT at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
2017-06-01T21:51:55.80+0530 [App/0] OUT ... 53 common frames omitted
2017-06-01T21:51:55.81+0530 [App/0] ERR
Saurav
Upvotes: 0
Views: 1170
Reputation: 5926
ok...finally i was able to tie all loose threads on this topic.
Just to summarize the overall solution for other readers. For some more details you can visit here No unique service maching interface error in Spring Boot Cloud Foundry error
If you have a scenario where you want to have a spring boot application talk to a database (hosted in other machine) and then run the application from cloud foundry. Then follow some of the tips below.
Once you deploy your Spring Boot application and want to use Spring Boot cloud connector make sure you have all the proper dependencies in your classpath (spring-boot-cloud-connector and jar. If you want to bind a service instance with the application .
Make sure the credentials adhere to this specification http://cloud.spring.io/spring-cloud-connectors/spring-cloud-cloud-foundry-connector.html#_postgresql
In the service instance parameters make sure you use the uri parameter not depend on the username and password to construct the uri
Make sure your database instance is actually running and you have created application service groups to allow outbound communication from your cloud foundry app. https://docs.cloudfoundry.org/concepts/asg.html#viewing
Steps 3 and 4 were the mistakes i made. Once corrected the application works fine.
Best Regards, Saurav
Upvotes: 0