我是Cloud Foundry的新手,我已经部署了本地bosh-lite CF安装。
我有一个带有Hibernate JPA应用程序的Spring Boot,它连接到postgresql,后者再次在本地运行,我想部署。
为此,我为postgresql创建了一个用户提供的服务,其服务实例参数包括主机,端口,用户名和密码。
现在我部署了应用程序并将应用程序绑定到服务实例。
现在,当我重新启动应用程序时,应用程序失败,并且数据库实例出现了一些连接错误(主机名错误)。 我使用cfups命令更改了服务实例参数以更新主机参数。该命令返回0作为响应。
现在我重新启动应用程序以使更改生效。但该应用程序再次失败,同样的错误指向旧的主机参数。
似乎参数更改没有使用cfups命令发生,或者某种程度上应用程序没有使用新参数重新进行。
另一个问题是如何查看已在运行的服务实例的当前服务实例参数。 ? cf service servicename仅提供名称和绑定的应用程序
更新
我遵循Scott Frederick的https://www.youtube.com/watch?v=g3DbtW5lwqY教程并使用第三个选项,即在我的类路径中配置spring boot cloud connector和postgresql驱动程序。
因此,在我的方案中,我的方案
以下是我的cf env app`的输出。主机服务实例参数" postgressql-service-instance1"是我的主机的IP,其中有postgresql isntalled。我在一个基于Vagrant的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
正如您所看到的,我的应用程序已绑定到某项服务。但是,当我尝试重新启动时,重新启动应用程序我得到以下错误`这清楚地表明连接被拒绝在localhost:5432。但我没有使用localhost作为连接的主机服务参数。
我已将postgresql实例配置为接受来自客户操作系统的连接。我不知道Spring Boot如何获得主机名" 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
答案 0 :(得分:0)
好的......最后我能够在这个主题上绑定所有松散的主题。
总结一下其他读者的整体解决方案。有关详细信息,请访问No unique service maching interface error in Spring Boot Cloud Foundry error
如果您有一个场景,您希望让Spring引导应用程序与数据库通信(在其他计算机中托管),然后从云代工厂运行该应用程序。然后按照以下一些提示进行操作。
部署Spring Boot应用程序并希望使用Spring Boot云连接器后,请确保在类路径中具有所有正确的依赖关系(spring-boot-cloud-connector和jar。 如果要将服务实例与应用程序绑定。
确保凭据符合此规范http://cloud.spring.io/spring-cloud-connectors/spring-cloud-cloud-foundry-connector.html#_postgresql
在服务实例参数中,请确保使用uri参数不依赖于用户名和密码来构建uri
确保您的数据库实例实际正在运行,并且您已创建应用程序服务组以允许来自您的云代工厂应用程序的出站通信。 https://docs.cloudfoundry.org/concepts/asg.html#viewing
第3步和第4步是我犯的错误。一旦纠正,应用程序工作正常。
最诚挚的问候,Saurav