ローカルクラウドスプリングコネクタを使用してアプリケーションをローカル環境でテストしてから、CFベースのクラウド環境にデプロイできます。春のリンクローカルのスプリングクラウドコネクタ/ local_configuration_connectorを使用しようとしたときに適切なクラウドコネクタが見つかりません
から私は、プロセスを踏襲し、作成したプロパティは、プロジェクトのリソースディレクトリ内の名前spring-cloud-bootstrap.propertiesを持つファイル。これは、次の内容を持っている
spring.cloud.propertiesFile:C:\ Users \ユーザーIBM_ADMIN \ gitの\ ServiceXchange5 \ ServiceXchange \ spring-cloud.properties
私はパス内のファイルspring-cloud.propertiesを持っています上記のとおりです。私は今、このデータソースBeanは、様々な他の場所に注入され
@EnableWebMvc
@Configuration
@EnableAspectJAutoProxy
public class CloudServiceConfig extends AbstractCloudConfig {
@Bean
public DataSource getDataSource() throws AppException {
org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig poolConfig = new PoolConfig(50, 100, 3000);
org.springframework.cloud.service.relational.DataSourceConfig dbConfig = new DataSourceConfig(poolConfig, null);
return connectionFactory().dataSource(SX_DB_USED, dbConfig);
}
を以下しているスプリングconfiguaration豆から
。プロパティファイルを使用すると、ローカル構成用のクラウドコネクタBeanが作成され、接続プール用のDataSourceの構成を追加するために同じものを使用できるはずです。
ただし、アプリケーションにアクセスすると、ローカルのConfigurationコネクタ自体のように見えますが、それはアクティブ化されていないようです。
Initialization of bean failed; nested exception is org.springframework.cloud.CloudException: No suitable cloud connector found
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [appServlet] in application [ServiceXchange]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cloudServiceConfig' defined in file [C:\Users\IBM_ADMIN\git\ServiceXchange5\ServiceXchange\target\classes\com\hcl\service\config\CloudServiceConfig.class]: Initialization of bean failed; nested exception is org.springframework.cloud.CloudException: No suitable cloud connector found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2388)
at [internal classes]
Caused by: org.springframework.cloud.CloudException: No suitable cloud connector found
at org.springframework.cloud.CloudFactory.getCloud(CloudFactory.java:55)
at org.springframework.cloud.config.java.AbstractCloudConfig.setBeanFactory(AbstractCloudConfig.java:85)
at com.hcl.service.config.CloudServiceConfig$$EnhancerBySpringCGLIB$$9529c032.CGLIB$setBeanFactory$54(<generated>)
at com.hcl.service.config.CloudServiceConfig$$EnhancerBySpringCGLIB$$9529c032$$FastClassBySpringCGLIB$$6c6301dd.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareMethodInterceptor.intercept(ConfigurationClassEnhancer.java:277)
at com.hcl.service.config.CloudServiceConfig$$EnhancerBySpringCGLIB$$9529c032.setBeanFactory(<generated>)
at org.springframework.context.annotation.ConfigurationClassPostProcessor$EnhancedConfigurationBeanPostProcessor.postProcessPropertyValues(ConfigurationClassPostProcessor.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
... 13 more
ローカルクラウドコネクタが有効化されていない理由はわかりません。リンクごとに、プロパティファイルを検出した後にそれを設定する必要があります。
注:私はここに
すべてのヘルプ(リソースなどで、WEB-INF/libに、直接アプリケーションルートの下)のように別の場所にプロパティファイルを入れて試してみましたか?
可能性のある最も簡単な問題から始めて、プロジェクトに必要なすべてのjarファイルがあることを確認するために依存関係リストを共有できますか?ここ –
@Scottは、POMエントリ org.springframework.cloud 春-クラウドlocalConfigのコネクタ 1.2.3.RELEASE org.springframework.cloud 春です-cloud-spring-service-connector 1.2.3。リリース –
クラウドファウンドリコネクタを追加しようとしましたが(ローカルコンフィグレーションには必要ありませんが)、同じエラーが発生しました。 Spring側からは4.2.6バージョンを使用しています –