SpringBoot + mybatis + mysql应用过程中问题记录-问题4(HikariPool-1 - jdbcUrl is required with driverClassName)

问题:

2018-10-10 16:51:12.420 ERROR 5332 --- [           main] com.zaxxer.hikari.HikariConfig           : HikariPool-1 - jdbcUrl is required with driverClassName.

2018-10-10 16:51:12.423  WARN 5332 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.

2018-10-10 16:51:12.424  INFO 5332 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

2018-10-10 16:51:12.430  INFO 5332 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2018-10-10 16:51:12.435 ERROR 5332 --- [           main] o.s.boot.SpringApplication               : Application run failed

 解决方法,将数据源配置文件

first.datasource.url=jdbc:MySQL://192.168.1.30:30006/nbsmt2?useUnicode=true&characterEncoding=utf-8
first.datasource.username=root
first.datasource.password=123456
first.datasource.driver-class-name=com.mysql.jdbc.Driver
first.datasource.type=mysql

second.datasource.url=jdbc:MySQL://192.168.1.32:3306/test?useUnicode=true&characterEncoding=utf-8
second.datasource.username=score
second.datasource.password=123456
second.datasource.driver-class-name=com.mysql.jdbc.Driver
second.datasource.type=mysql

改为

first.datasource.jdbc-url=jdbc:MySQL://192.168.1.30:30006/nbsmt2?useUnicode=true&characterEncoding=utf-8
first.datasource.username=root
first.datasource.password=123456
first.datasource.driver-class-name=com.mysql.jdbc.Driver
first.datasource.type=mysql

second.datasource.jdbc-url=jdbc:MySQL://192.168.1.32:3306/test?useUnicode=true&characterEncoding=utf-8
second.datasource.username=score
second.datasource.password=123456
second.datasource.driver-class-name=com.mysql.jdbc.Driver
second.datasource.type=mysql

原因分析(原因分析来自百度搜索得来):Hikari没有url属性,但是有一个jdbcUrl属性。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐乐Gold

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值