Unable to create XADataSource instance from 'com.mysql.cj.jdbc.MysqlXADataSource'

た 入场券 2023-06-16 10:59 117阅读 0赞
  1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path
  2. resource [org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfiguration.class]: Bean instantiation via factory
  3. method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
  4. [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException:
  5. Unable to create XADataSource instance from'com.mysql.cj.jdbc.MysqlXADataSource'
  6. atorg.springframework.beans.factory.support.ConstructorResolver.instantiate
  7. Unable to create XADataSource instance from 'com.mysql.cj.jdbc.MysqlXADataSource'

今早打开IDEA启动项目,发现报了这个错误,这个是提示说,数据库需要换成6.0以上,那么就在pom.xml,文件里面把mysql改成6.0以上版本,如下:

  1. <dependency>
  2. <groupId>mysql</groupId>
  3. <artifactId>mysql-connector-java</artifactId>
  4. <version>8.0.16</version>
  5. </dependency>

接着改了yml配置,把以前5.0的配置改成6.0以后的,如下:

5.0前版本的是:

  1. driverClassName: com.mysql.jdbc.Driver

6.0后版本是:

  1. driverClassName: com.mysql.cj.jdbc.Driver

发表评论

表情:
评论列表 (有 0 条评论,117人围观)

还没有评论,来说两句吧...

相关阅读