没有合适的 ServiceConnectorCreator
No suitable ServiceConnectorCreator
我正在尝试将 spring 应用程序推送到 PCF。这样做时,出现以下错误:用户提供的服务存在。
Error creating bean with name 'dataSourceNWTC' defined in class path resource [com/*//****/*//config/CloudConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.sql.DataSource com.*****.....config.CloudConfig.nwPrepDataSource()] threw exception; nested exception is org.springframework.cloud.CloudException: No suitable ServiceConnectorCreator found: service id=dataSource-NWTC, service info type=org.springframework.cloud.service.BaseServiceInfo, connector type=interface javax.sql.DataSource
我试过几个版本。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
<version>2.0.6.RELEASE</version>
<repositories>
<repository>
<id>repository.springsource.milestone</id>
<name>SpringSource Milestone Repository</name>
<url>http://repo.springsource.org/milestone</url>
</repository>
@Configuration
@ServiceScan
@Profile("cloud")
public class CloudConfig extends AbstractCloudConfig {
@Bean(name = "dataSourceAIMS")
public DataSource aimsDataSource() {
return connectionFactory().dataSource("dataSource-AIMS");
}
@Bean(name = "dataSourceNWTC")
public DataSource nwPrepDataSource() {
return connectionFactory().dataSource("dataSource-NWTC");
}
}
applications:
- name: some-name
path: target/some-name-1.0-SNAPSHOT.war
random-route: true
buildpacks:
- java_buildpack_offline
services:
- dataSource-AIMS
- dataSource-NWTC
env:
SPRING_PROFILES_ACTIVE: cloud
No suitable ServiceConnectorCreator found
当 Spring Cloud Connector 不知道如何根据它在 VCAP_SERVICES
中获得的服务信息创建服务对象时,您会看到这一点。查看VCAP_SERVICES
,看看服务类型是不是supported by SCC。此外,查看并确认服务信息的结构方式是受支持的数据库类型能够理解的。
除此之外,我强烈建议您查看 java-cfenv 而不是 Spring 云连接器。我相信它是 Spring Cloud Connectors 的继任者。
希望对您有所帮助!
我正在尝试将 spring 应用程序推送到 PCF。这样做时,出现以下错误:用户提供的服务存在。
Error creating bean with name 'dataSourceNWTC' defined in class path resource [com/*//****/*//config/CloudConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.sql.DataSource com.*****.....config.CloudConfig.nwPrepDataSource()] threw exception; nested exception is org.springframework.cloud.CloudException: No suitable ServiceConnectorCreator found: service id=dataSource-NWTC, service info type=org.springframework.cloud.service.BaseServiceInfo, connector type=interface javax.sql.DataSource
我试过几个版本。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
<version>2.0.6.RELEASE</version>
<repositories>
<repository>
<id>repository.springsource.milestone</id>
<name>SpringSource Milestone Repository</name>
<url>http://repo.springsource.org/milestone</url>
</repository>
@Configuration
@ServiceScan
@Profile("cloud")
public class CloudConfig extends AbstractCloudConfig {
@Bean(name = "dataSourceAIMS")
public DataSource aimsDataSource() {
return connectionFactory().dataSource("dataSource-AIMS");
}
@Bean(name = "dataSourceNWTC")
public DataSource nwPrepDataSource() {
return connectionFactory().dataSource("dataSource-NWTC");
}
}
applications:
- name: some-name
path: target/some-name-1.0-SNAPSHOT.war
random-route: true
buildpacks:
- java_buildpack_offline
services:
- dataSource-AIMS
- dataSource-NWTC
env:
SPRING_PROFILES_ACTIVE: cloud
No suitable ServiceConnectorCreator found
当 Spring Cloud Connector 不知道如何根据它在 VCAP_SERVICES
中获得的服务信息创建服务对象时,您会看到这一点。查看VCAP_SERVICES
,看看服务类型是不是supported by SCC。此外,查看并确认服务信息的结构方式是受支持的数据库类型能够理解的。
除此之外,我强烈建议您查看 java-cfenv 而不是 Spring 云连接器。我相信它是 Spring Cloud Connectors 的继任者。
希望对您有所帮助!