找不到 javax.sql.DataSource 类型的 bean。跳过自动重新配置
No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration
我正在尝试将默认的 JHipster UUA 应用程序部署到我的 cloudfoundry(产品配置文件),其中 MySQL 作为 DB 选项。 MySQL 服务已创建并正确绑定到应用程序。我在下面发布了 stackstrace 和 cf env。请注意,我已经用 [括号之间的内容] 掩盖了连接信息。
有两个主要错误,我怀疑第一个与另一个有关:
- 未找到 javax.sql.DataSource 类型的 beans。跳绳
自动重新配置。
- 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'
我正在使用 yo jhipster:cloudfoundry
进行部署,选择产品配置文件(但也尝试过手动)并编辑了 bootstrap-prod.yml
和 application-prod.yml
以将 url 包含到我的 Jhipster-registry 实例,它也在同一个 cloudfoundry space 中运行(并且没有问题)。所以 spring.cloud.config.uri
和 client.serviceUrl.defaultZone
变成:http://admin:admin@jhipsterregistry.[my.domain.com]/config
。此外,我将 sping 连接器用于 cloudfoundry,并为在生产中部署时使用的云配置文件定义了一个数据源。见下文。
@Configuration
@Profile(Constants.SPRING_PROFILE_CLOUD)
public class CloudDatabaseConfiguration extends AbstractCloudConfig {
private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class);
@Bean
public DataSource dataSource(CacheManager cacheManager) {
log.info("Configuring JDBC datasource from a cloud provider");
return connectionFactory().dataSource();
}
}
Pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
</dependency>
和我的主要 app.java.
@ComponentScan
@EnableAutoConfiguration(exclude = { MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class })
@EnableConfigurationProperties({ JHipsterProperties.class, LiquibaseProperties.class })
@EnableEurekaClient
public class JanusApp { .. }
以下是失败应用程序的环境变量和日志。 JHipster 网站上未提供其他信息。任何帮助将不胜感激。
应用程序环境变量:
$ cf env janus
Getting env variables for app janus in org [something] / space dev as [someone@something.com]...
OK
System-Provided:
{
"VCAP_SERVICES": {
"p-mysql": [
{
"credentials": {
"hostname": "10.10.32.14",
"jdbcUrl": "jdbc:mysql://[generated]:[generated]@10.10.32.14:3306/cf_42fa757f_80f1_[remainder]",
"name": "cf_42fa757f_80f1_[remainder]",
"password": "[generated]",
"port": 3306,
"uri": "mysql://[generated]:[generated]@10.10.32.14:3306/cf_42fa757f_80f1_[remainder]?reconnect=true",
"username": "[generated]"
},
"label": "p-mysql",
"name": "janus",
"plan": "100mb-dev",
"provider": null,
"syslog_drain_url": null,
"tags": [
"mysql"
]
}
]
}
}
{
"VCAP_APPLICATION": {
"application_id": "435b6c8c-ca4b-46b8-a769-65fc5eacd7dd",
"application_name": "janus",
"application_uris": [
"janus.[my.domain.com]"
],
"application_version": "4c8084ec-3f83-4518-8129-4bf3c3e38594",
"limits": {
"disk": 1024,
"fds": 16384,
"mem": 1024
},
"name": "janus",
"space_id": "eba312c0-9643-45b7-ba36-d6dfd523e4ae",
"space_name": "dev",
"uris": [
"janus.[my.domain.com]"
],
"users": null,
"version": "4c8084ec-3f83-4518-8129-4bf3c3e38594"
}
}
应用程序日志:
2016-08-12T07:49:32.56+0200 [DEA/56] OUT Stopping app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:49:32.56+0200 [DEA/56] OUT Stopped app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:56:06.08+0200 [DEA/12] OUT Starting app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:56:11.15+0200 [App/0] OUT 05:56:11.147 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Loading from YAML: class path resource [config/application.yml]
2016-08-12T07:56:11.19+0200 [App/0] OUT 05:56:11.198 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Merging document (no matchers set): {eureka={instance={appname=janus, instanceId=janus:${spring.application.instance_id:${random.value}}}}, ribbon={eureka={enabled=true}}, management={context-path=/management, health={mail={enabled=false}}}, spring={application={name=janus}, profiles={active=prod}, jackson={serialization.write_dates_as_timestamps=false}, jpa={open-in-view=false, hibernate={ddl-auto=none, naming-strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy}}, messages={basename=i18n/messages}, mvc={favicon={enabled=false}}, thymeleaf={mode=XHTML}}, security={basic={enabled=false}}, jhipster={async={corePoolSize=2, maxPoolSize=50, queueCapacity=10000}, mail={from=janus@localhost}, swagger={title=janus API, description=janus API documentation, version=0.0.1, termsOfServiceUrl=null, contactName=null, contactUrl=null, contactEmail=null, license=null, licenseUrl=null}, ribbon={displayOnActiveProfiles=dev}}}
2016-08-12T07:56:11.19+0200 [App/0] OUT 05:56:11.199 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Loaded 1 document from YAML resource: class path resource [config/application.yml]
2016-08-12T07:56:13.14+0200 [App/0] OUT 2016-08-12 05:56:13.145 INFO 29 --- [ main] pertySourceApplicationContextInitializer : Adding 'cloud' PropertySource to ApplicationContext
2016-08-12T07:56:13.26+0200 [App/0] OUT 2016-08-12 05:56:13.266 INFO 29 --- [ main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
2016-08-12T07:56:14.11+0200 [App/0] OUT 2016-08-12 05:56:14.116 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type javax.sql.DataSource
2016-08-12T07:56:14.12+0200 [App/0] OUT 2016-08-12 05:56:14.119 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ████████ ███████ ██████ ████████ ████████ ███████
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ████████ ██ ███████ █████ ██ ██████ ███████
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT ██████ ██ ██ ████████ ██ ██████ ██ ████████ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT :: JHipster :: Running Spring Boot 1.3.6.RELEASE ::
2016-08-12T07:56:15.25+0200 [App/0] OUT :: http://jhipster.github.io ::
2016-08-12T07:56:15.86+0200 [App/0] OUT 2016-08-12 05:56:15.861 INFO 29 --- [ main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
2016-08-12T07:56:15.86+0200 [App/0] OUT 2016-08-12 05:56:15.863 INFO 29 --- [ main] com.philips.janus.JanusApp : The following profiles are active: cloudfoundry,prod,cloudfoundry,cloud
2016-08-12T07:56:19.13+0200 [App/0] OUT 2016-08-12 05:56:19.135 WARN 29 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration$TokenKeyEndpointRegistrar' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-08-12T07:56:19.13+0200 [App/0] OUT 2016-08-12 05:56:19.135 WARN 29 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.481 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type javax.sql.DataSource
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] ongoCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.mongodb.MongoDbFactory
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] bbitCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] edisCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.redis.connection.RedisConnectionFactory
2016-08-12T07:56:20.85+0200 [App/0] OUT 2016-08-12 05:56:20.853 INFO 29 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.6.1] Prefer IPv4 stack is true.
2016-08-12T07:56:20.86+0200 [App/0] OUT 2016-08-12 05:56:20.867 INFO 29 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.6.1] Picked Address[10.254.1.126]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
2016-08-12T07:56:21.62+0200 [App/0] OUT 2016-08-12 05:56:21.627 INFO 29 --- [ main] com.hazelcast.spi.OperationService : [10.254.1.126]:5701 [dev] [3.6.1] Backpressure is disabled
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Hazelcast 3.6.1 (20160228 - d0d2a77) starting at Address[10.254.1.126]:5701
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Configured Hazelcast Serialization version : 1
2016-08-12T07:56:22.60+0200 [App/0] OUT 2016-08-12 05:56:22.607 INFO 29 --- [ main] com.hazelcast.instance.Node : [10.254.1.126]:5701 [dev] [3.6.1] Creating MulticastJoiner
2016-08-12T07:56:22.61+0200 [App/0] OUT 2016-08-12 05:56:22.614 INFO 29 --- [ main] com.hazelcast.core.LifecycleService : [10.254.1.126]:5701 [dev] [3.6.1] Address[10.254.1.126]:5701 is STARTING
2016-08-12T07:56:25.78+0200 [App/0] OUT 2016-08-12 05:56:25.780 INFO 29 --- [ main] c.h.cluster.impl.MulticastJoiner : [10.254.1.126]:5701 [dev] [3.6.1]
2016-08-12T07:56:25.78+0200 [App/0] OUT Members [1] {
2016-08-12T07:56:25.78+0200 [App/0] OUT Member [10.254.1.126]:5701 this
2016-08-12T07:56:25.78+0200 [App/0] OUT }
2016-08-12T07:56:25.84+0200 [App/0] OUT 2016-08-12 05:56:25.847 INFO 29 --- [ main] com.hazelcast.core.LifecycleService : [10.254.1.126]:5701 [dev] [3.6.1] Address[10.254.1.126]:5701 is STARTED
2016-08-12T07:56:28.16+0200 [App/0] OUT 2016-08-12 05:56:28.165 INFO 29 --- [ost-startStop-1] com.philips.janus.config.WebConfigurer : Web application configuration, using profiles: [ cloudfoundry, prod, cloudfoundry, cloud]
2016-08-12T07:56:28.17+0200 [App/0] OUT 2016-08-12 05:56:28.175 INFO 29 --- [ost-startStop-1] com.philips.janus.config.WebConfigurer : Web application fully configured
2016-08-12T07:56:29.31+0200 [App/0] OUT 2016-08-12 05:56:29.315 INFO 29 --- [ost-startStop-1] c.p.j.config.CloudDatabaseConfiguration : Configuring JDBC datasource from a cloud provider
2016-08-12T07:56:29.80+0200 [App/0] OUT 2016-08-12 05:56:29.807 WARN 29 --- [ost-startStop-1] o.a.tomcat.jdbc.pool.ConnectionPool : maxIdle is larger than maxActive, setting maxIdle to: 4
2016-08-12T07:56:29.91+0200 [App/0] OUT 2016-08-12 05:56:29.917 ERROR 29 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception starting filter springSecurityFilterChain
2016-08-12T07:56:29.91+0200 [App/0] OUT org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1060)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:109)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4689)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5329)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.lang.Thread.run(Thread.java:745)
2016-08-12T07:56:29.91+0200 [App/0] OUT Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:661)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
2016-08-12T07:56:29.91+0200 [App/0] OUT ... 31 common frames omitted
2016-08-12T07:56:29.91+0200 [App/0] OUT Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
消息来自 Java Buildpack auto-reconfiguration 库。只要 JBP 检测到正在部署 Spring 应用程序,它就会在暂存期间将此库添加到应用程序类路径。该库在 Spring 应用程序上下文中查找类型为 DataSource
的单个 bean,如果找到,会将其换成一个 DataSource
bean,该 bean 配置了来自绑定关系数据库服务的连接详细信息.
您希望此 JHipster 应用程序在 Spring 应用程序上下文中提供 DataSource
bean 吗?
与其期望 JBP 自动重新配置库将现有的 DataSource
bean 换成应用程序中已有的 bean,不如让 Spring Cloud Connectors generate a DataSource
bean from the db bound to the app. To do this, you just need to add the Connectors dependencies to your project and enable service scanning 在您的 Spring 配置。
我正在尝试将默认的 JHipster UUA 应用程序部署到我的 cloudfoundry(产品配置文件),其中 MySQL 作为 DB 选项。 MySQL 服务已创建并正确绑定到应用程序。我在下面发布了 stackstrace 和 cf env。请注意,我已经用 [括号之间的内容] 掩盖了连接信息。
有两个主要错误,我怀疑第一个与另一个有关:
- 未找到 javax.sql.DataSource 类型的 beans。跳绳 自动重新配置。
- 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'
我正在使用 yo jhipster:cloudfoundry
进行部署,选择产品配置文件(但也尝试过手动)并编辑了 bootstrap-prod.yml
和 application-prod.yml
以将 url 包含到我的 Jhipster-registry 实例,它也在同一个 cloudfoundry space 中运行(并且没有问题)。所以 spring.cloud.config.uri
和 client.serviceUrl.defaultZone
变成:http://admin:admin@jhipsterregistry.[my.domain.com]/config
。此外,我将 sping 连接器用于 cloudfoundry,并为在生产中部署时使用的云配置文件定义了一个数据源。见下文。
@Configuration
@Profile(Constants.SPRING_PROFILE_CLOUD)
public class CloudDatabaseConfiguration extends AbstractCloudConfig {
private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class);
@Bean
public DataSource dataSource(CacheManager cacheManager) {
log.info("Configuring JDBC datasource from a cloud provider");
return connectionFactory().dataSource();
}
}
Pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
</dependency>
和我的主要 app.java.
@ComponentScan
@EnableAutoConfiguration(exclude = { MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class })
@EnableConfigurationProperties({ JHipsterProperties.class, LiquibaseProperties.class })
@EnableEurekaClient
public class JanusApp { .. }
以下是失败应用程序的环境变量和日志。 JHipster 网站上未提供其他信息。任何帮助将不胜感激。
应用程序环境变量:
$ cf env janus
Getting env variables for app janus in org [something] / space dev as [someone@something.com]...
OK
System-Provided:
{
"VCAP_SERVICES": {
"p-mysql": [
{
"credentials": {
"hostname": "10.10.32.14",
"jdbcUrl": "jdbc:mysql://[generated]:[generated]@10.10.32.14:3306/cf_42fa757f_80f1_[remainder]",
"name": "cf_42fa757f_80f1_[remainder]",
"password": "[generated]",
"port": 3306,
"uri": "mysql://[generated]:[generated]@10.10.32.14:3306/cf_42fa757f_80f1_[remainder]?reconnect=true",
"username": "[generated]"
},
"label": "p-mysql",
"name": "janus",
"plan": "100mb-dev",
"provider": null,
"syslog_drain_url": null,
"tags": [
"mysql"
]
}
]
}
}
{
"VCAP_APPLICATION": {
"application_id": "435b6c8c-ca4b-46b8-a769-65fc5eacd7dd",
"application_name": "janus",
"application_uris": [
"janus.[my.domain.com]"
],
"application_version": "4c8084ec-3f83-4518-8129-4bf3c3e38594",
"limits": {
"disk": 1024,
"fds": 16384,
"mem": 1024
},
"name": "janus",
"space_id": "eba312c0-9643-45b7-ba36-d6dfd523e4ae",
"space_name": "dev",
"uris": [
"janus.[my.domain.com]"
],
"users": null,
"version": "4c8084ec-3f83-4518-8129-4bf3c3e38594"
}
}
应用程序日志:
2016-08-12T07:49:32.56+0200 [DEA/56] OUT Stopping app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:49:32.56+0200 [DEA/56] OUT Stopped app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:56:06.08+0200 [DEA/12] OUT Starting app instance (index 0) with guid 435b6c8c-ca4b-46b8-a769-65fc5eacd7dd
2016-08-12T07:56:11.15+0200 [App/0] OUT 05:56:11.147 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Loading from YAML: class path resource [config/application.yml]
2016-08-12T07:56:11.19+0200 [App/0] OUT 05:56:11.198 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Merging document (no matchers set): {eureka={instance={appname=janus, instanceId=janus:${spring.application.instance_id:${random.value}}}}, ribbon={eureka={enabled=true}}, management={context-path=/management, health={mail={enabled=false}}}, spring={application={name=janus}, profiles={active=prod}, jackson={serialization.write_dates_as_timestamps=false}, jpa={open-in-view=false, hibernate={ddl-auto=none, naming-strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy}}, messages={basename=i18n/messages}, mvc={favicon={enabled=false}}, thymeleaf={mode=XHTML}}, security={basic={enabled=false}}, jhipster={async={corePoolSize=2, maxPoolSize=50, queueCapacity=10000}, mail={from=janus@localhost}, swagger={title=janus API, description=janus API documentation, version=0.0.1, termsOfServiceUrl=null, contactName=null, contactUrl=null, contactEmail=null, license=null, licenseUrl=null}, ribbon={displayOnActiveProfiles=dev}}}
2016-08-12T07:56:11.19+0200 [App/0] OUT 05:56:11.199 [main] DEBUG org.springframework.beans.factory.config.YamlPropertiesFactoryBean - Loaded 1 document from YAML resource: class path resource [config/application.yml]
2016-08-12T07:56:13.14+0200 [App/0] OUT 2016-08-12 05:56:13.145 INFO 29 --- [ main] pertySourceApplicationContextInitializer : Adding 'cloud' PropertySource to ApplicationContext
2016-08-12T07:56:13.26+0200 [App/0] OUT 2016-08-12 05:56:13.266 INFO 29 --- [ main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
2016-08-12T07:56:14.11+0200 [App/0] OUT 2016-08-12 05:56:14.116 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type javax.sql.DataSource
2016-08-12T07:56:14.12+0200 [App/0] OUT 2016-08-12 05:56:14.119 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ████████ ███████ ██████ ████████ ████████ ███████
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ████████ ██ ███████ █████ ██ ██████ ███████
2016-08-12T07:56:15.25+0200 [App/0] OUT ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT ██████ ██ ██ ████████ ██ ██████ ██ ████████ ██ ██
2016-08-12T07:56:15.25+0200 [App/0] OUT :: JHipster :: Running Spring Boot 1.3.6.RELEASE ::
2016-08-12T07:56:15.25+0200 [App/0] OUT :: http://jhipster.github.io ::
2016-08-12T07:56:15.86+0200 [App/0] OUT 2016-08-12 05:56:15.861 INFO 29 --- [ main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
2016-08-12T07:56:15.86+0200 [App/0] OUT 2016-08-12 05:56:15.863 INFO 29 --- [ main] com.philips.janus.JanusApp : The following profiles are active: cloudfoundry,prod,cloudfoundry,cloud
2016-08-12T07:56:19.13+0200 [App/0] OUT 2016-08-12 05:56:19.135 WARN 29 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration$TokenKeyEndpointRegistrar' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-08-12T07:56:19.13+0200 [App/0] OUT 2016-08-12 05:56:19.135 WARN 29 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.481 INFO 29 --- [ main] urceCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type javax.sql.DataSource
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] ongoCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.mongodb.MongoDbFactory
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] bbitCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory
2016-08-12T07:56:19.48+0200 [App/0] OUT 2016-08-12 05:56:19.482 INFO 29 --- [ main] edisCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.redis.connection.RedisConnectionFactory
2016-08-12T07:56:20.85+0200 [App/0] OUT 2016-08-12 05:56:20.853 INFO 29 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.6.1] Prefer IPv4 stack is true.
2016-08-12T07:56:20.86+0200 [App/0] OUT 2016-08-12 05:56:20.867 INFO 29 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.6.1] Picked Address[10.254.1.126]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
2016-08-12T07:56:21.62+0200 [App/0] OUT 2016-08-12 05:56:21.627 INFO 29 --- [ main] com.hazelcast.spi.OperationService : [10.254.1.126]:5701 [dev] [3.6.1] Backpressure is disabled
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Hazelcast 3.6.1 (20160228 - d0d2a77) starting at Address[10.254.1.126]:5701
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
2016-08-12T07:56:22.59+0200 [App/0] OUT 2016-08-12 05:56:22.594 INFO 29 --- [ main] com.hazelcast.system : [10.254.1.126]:5701 [dev] [3.6.1] Configured Hazelcast Serialization version : 1
2016-08-12T07:56:22.60+0200 [App/0] OUT 2016-08-12 05:56:22.607 INFO 29 --- [ main] com.hazelcast.instance.Node : [10.254.1.126]:5701 [dev] [3.6.1] Creating MulticastJoiner
2016-08-12T07:56:22.61+0200 [App/0] OUT 2016-08-12 05:56:22.614 INFO 29 --- [ main] com.hazelcast.core.LifecycleService : [10.254.1.126]:5701 [dev] [3.6.1] Address[10.254.1.126]:5701 is STARTING
2016-08-12T07:56:25.78+0200 [App/0] OUT 2016-08-12 05:56:25.780 INFO 29 --- [ main] c.h.cluster.impl.MulticastJoiner : [10.254.1.126]:5701 [dev] [3.6.1]
2016-08-12T07:56:25.78+0200 [App/0] OUT Members [1] {
2016-08-12T07:56:25.78+0200 [App/0] OUT Member [10.254.1.126]:5701 this
2016-08-12T07:56:25.78+0200 [App/0] OUT }
2016-08-12T07:56:25.84+0200 [App/0] OUT 2016-08-12 05:56:25.847 INFO 29 --- [ main] com.hazelcast.core.LifecycleService : [10.254.1.126]:5701 [dev] [3.6.1] Address[10.254.1.126]:5701 is STARTED
2016-08-12T07:56:28.16+0200 [App/0] OUT 2016-08-12 05:56:28.165 INFO 29 --- [ost-startStop-1] com.philips.janus.config.WebConfigurer : Web application configuration, using profiles: [ cloudfoundry, prod, cloudfoundry, cloud]
2016-08-12T07:56:28.17+0200 [App/0] OUT 2016-08-12 05:56:28.175 INFO 29 --- [ost-startStop-1] com.philips.janus.config.WebConfigurer : Web application fully configured
2016-08-12T07:56:29.31+0200 [App/0] OUT 2016-08-12 05:56:29.315 INFO 29 --- [ost-startStop-1] c.p.j.config.CloudDatabaseConfiguration : Configuring JDBC datasource from a cloud provider
2016-08-12T07:56:29.80+0200 [App/0] OUT 2016-08-12 05:56:29.807 WARN 29 --- [ost-startStop-1] o.a.tomcat.jdbc.pool.ConnectionPool : maxIdle is larger than maxActive, setting maxIdle to: 4
2016-08-12T07:56:29.91+0200 [App/0] OUT 2016-08-12 05:56:29.917 ERROR 29 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception starting filter springSecurityFilterChain
2016-08-12T07:56:29.91+0200 [App/0] OUT org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1060)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:109)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4689)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5329)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-08-12T07:56:29.91+0200 [App/0] OUT at java.lang.Thread.run(Thread.java:745)
2016-08-12T07:56:29.91+0200 [App/0] OUT Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:661)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
2016-08-12T07:56:29.91+0200 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
2016-08-12T07:56:29.91+0200 [App/0] OUT ... 31 common frames omitted
2016-08-12T07:56:29.91+0200 [App/0] OUT Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uaaWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.philips.janus.config.UaaWebSecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.philips.janus.repository.UserRepository com.philips.janus.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#5b9e4908' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b9e4908': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/philips/janus/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "[generated]@10.10.32.14:3306"'.
No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
消息来自 Java Buildpack auto-reconfiguration 库。只要 JBP 检测到正在部署 Spring 应用程序,它就会在暂存期间将此库添加到应用程序类路径。该库在 Spring 应用程序上下文中查找类型为 DataSource
的单个 bean,如果找到,会将其换成一个 DataSource
bean,该 bean 配置了来自绑定关系数据库服务的连接详细信息.
您希望此 JHipster 应用程序在 Spring 应用程序上下文中提供 DataSource
bean 吗?
与其期望 JBP 自动重新配置库将现有的 DataSource
bean 换成应用程序中已有的 bean,不如让 Spring Cloud Connectors generate a DataSource
bean from the db bound to the app. To do this, you just need to add the Connectors dependencies to your project and enable service scanning 在您的 Spring 配置。