加入spring-boot-starter-data-jpa依赖报错,详情如下

来源:5-3 负载均衡器:Ribbon

慕容8210840

2020-12-03

2020-11-25 23:42:47.444 WARN 8952 — [ 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/HibernateJpaAutoConfiguration.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/HibernateJpaAutoConfiguration.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/HibernateJpaAutoConfiguration.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.NoClassDefFoundError: com/mysql/jdbc/ConnectionProperties

写回答

2回答

廖师兄

2020-12-04

数据库版本不对。电脑上mysql软件和项目里pom.xml里的mysql依赖都要用课程里说的版本

0
0

慕容8210840

提问者

2020-12-03

idea版本2018.2 。product服务刚开始,yml:

spring:
 application:
   name: product
 datasource:
   driver-class-name: com.mysql.jdbc.Driver
   username: root
   password: oppo123
   url: jdbc:mysql://127.0.0.1/SpringCloud_Sell?characterEncoding=utf-8&useSSL=false
     jdbc-url:
 jpa:
   show-sql: true
eureka:
 client:
   service-url:
     defaultZone: http://localhost:8761/eureka/

0
0

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5672 学习 · 2489 问题

查看课程