【发布时间】:2019-12-30 15:44:52
【问题描述】:
尝试在 Cloud Foundry 中部署 springboot 项目。出现以下错误。
原因: org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名称为“entityManagerFactoryBuilder”的bean时出错 类路径资源 [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 通过方法表达的不满足的依赖关系 'entityManagerFactoryBuilder' 参数 0;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建在类路径中定义的名称为“jpaVendorAdapter”的 bean 资源 [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 通过工厂方法实例化 Bean 失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:失败 实例化 [org.springframework.orm.jpa.JpaVendorAdapter]:工厂 方法“jpaVendorAdapter”抛出异常;嵌套异常是 java.lang.RuntimeException:驱动程序 com.microsoft.sqlserver.jdbc.SQLServerDriver 声称不接受 jdbcUrl, ${vcap.services.xxx.credentials.jdbcUrl}
application.properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.url=${vcap.services.xxx.credentials.jdbcUrl}
spring.datasource.username=${vcap.services.xxx.credentials.username}
spring.datasource.password=${vcap.services.xxx.credentials.password}
build.gradle
implementation 'org.springframework.boot:spring-boot-starter-web'
//cloud connector
implementation 'org.springframework.boot:spring-boot-starter-cloud-connectors'
//database
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc'
compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector'
预期:应该部署并运行 实际:标题错误
【问题讨论】:
标签: sql-server spring-boot spring-data-jpa cloud-foundry mssql-jdbc