springboot jpa mysql 报错,修改build.gradle依赖版本即可

本文档记录了在使用SpringBoot JPA连接MySQL时遇到的错误,错误涉及Hibernate、JDBC和数据库驱动版本不兼容。具体表现为无法打开JDBC连接进行DDL执行。解决方法是升级MySQL驱动jar包到更高版本,如将5.1.24改为更高版本。通过此改动,成功解决了因BigInteger与Long类型转换失败导致的ClassCastException。
摘要由CSDN通过智能技术生成

D:\Java\my\jdk1.8.0_191\bin\java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=56132 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\IntelliJ IDEA 2017.2.1\lib\idea_rt.jar=56133:D:\IntelliJ IDEA 2017.2.1\bin" -Dfile.encoding=UTF-8 -classpath D:\Java\my\jdk1.8.0_191\jre\lib\charsets.jar;D:\Java\my\jdk1.8.0_191\jre\lib\deploy.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\access-bridge-64.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\cldrdata.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\dnsns.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\jaccess.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\jfxrt.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\localedata.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\nashorn.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\sunec.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\sunjce_provider.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\sunmscapi.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\sunpkcs11.jar;D:\Java\my\jdk1.8.0_191\jre\lib\ext\zipfs.jar;D:\Java\my\jdk1.8.0_191\jre\lib\javaws.jar;D:\Java\my\jdk1.8.0_191\jre\lib\jce.jar;D:\Java\my\jdk1.8.0_191\jre\lib\jfr.jar;D:\Java\my\jdk1.8.0_191\jre\lib\jfxswt.jar;D:\Java\my\jdk1.8.0_191\jre\lib\jsse.jar;D:\Java\my\jdk1.8.0_191\jre\lib\management-agent.jar;D:\Java\my\jdk1.8.0_191\jre\lib\plugin.jar;D:\Java\my\jdk1.8.0_191\jre\lib\resources.jar;D:\Java\my\jdk1.8.0_191\jre\lib\rt.jar;D:\my\test01\springboot\out\production\classes;D:\my\test01\springboot\out\production\resources;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\mysql\mysql-connector-java\5.1.24\a7d599d73b86a928303909b9be7573a4ea0ed28e\mysql-connector-java-5.1.24.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.0.6.RELEASE\e803fc341b450b2ce01734df12e5881b8e78c0a7\spring-boot-starter-web-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.0.6.RELEASE\5c73f7a2c27920a32eefb8b172f3aa387295751b\spring-boot-starter-data-jpa-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.0.6.RELEASE\1b3912af3eecdbbc6cda497acc7939f2ce21e39d\spring-boot-starter-json-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.0.6.RELEASE\f3db2e05267686fd97af5460a155bac4298fab4d\spring-boot-starter-aop-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.0.6.RELEASE\5a65c8ce23562f18d70df947bffcd353e1ac2a41\spring-boot-starter-jdbc-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.0.6.RELEASE\9d904a4387e076343a3478c32198ec7d9d633ff4\spring-boot-starter-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.hibernate.validator\hibernate-validator\6.0.13.Final\af4232bf90ecd33c71147d67185dbb1cfe8f33df\hibernate-validator-6.0.13.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.0.10.RELEASE\88a601321e2b4e3b84eed0909c24b9dd8e453b5f\spring-webmvc-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.0.10.RELEASE\fbaaa53ec99f45fd7aaf9125beeb5c3388cce088\spring-web-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\javax.transaction\javax.transaction-api\1.2\d81aff979d603edd90dcd8db2abc1f4ce6479e3e\javax.transaction-api-1.2.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.2.17.Final\f2dc36470e7a2ffcf6106bb1625ecf5b54bb5f65\hibernate-core-5.2.17.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.0.11.RELEASE\40106aade7ec8ec9e3310d25a5c310dd7e8260d5\spring-data-jpa-2.0.11.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.0.10.RELEASE\1c86d8efa425cdbe7e6d2681816d388c0d30efa7\spring-aspects-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.0.6.RELEASE\e8c88fd703dbdf79f94178a5018ad67d1ecb1d0d\spring-boot-autoconfigure-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.0.6.RELEASE\4d214b08bbc74f03d404e8fc862102334e0f73d1\spring-boot-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.0.6.RELEASE\a730d62c8eb80cdc95e5089e47570d24731cf5dd\spring-boot-starter-logging-2.0.6.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.0.10.RELEASE\6f53de0618219fefc2aebf92ba175e6b33e14ce0\spring-context-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.0.10.RELEASE\da65874f61aef9c25db794f493e50683346d3056\spring-aop-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\5.0.10.RELEASE\ea0e14a753820eb47b63654e495ea370841da156\spring-orm-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.0.10.RELEASE\16ff6fad897185eb3fb01c58796de04b9b1e8c86\spring-jdbc-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.0.11.RELEASE\273e5cd5d6e772b5c4208b12771ed48647b2b9bb\spring-data-commons-2.0.11.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\5.0.10.RELEASE\55608ae84fde15eb942d675e3b1ee7d30394d4cb\spring-tx-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.0.10.RELEASE\8ec7da928082a123c50d5d70cd4b46382db27e8b\spring-beans-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.0.10.RELEASE\eaf8595e3bf18ef1aca1c233d9871552d258e38a\spring-expression-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.0.10.RELEASE\cb270a60ceb573961588f511222984de64b4bc96\spring-core-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.19\2d998d3d674b172a588e54ab619854d073f555b5\snakeyaml-1.19.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.9.7\98d8f190db07f97c64c0ea3af5792f718a6c2cc1\jackson-datatype-jdk8-2.9.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.9.7\cbd919f1ce67533e07b98dd493247e8dbabc26b2\jackson-datatype-jsr310-2.9.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.9.7\f2bdd7696beffa2dbc5dc62cd24c3906a40ffcff\jackson-module-parameter-names-2.9.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.9.7\e6faad47abd3179666e89068485a1b88a195ceb7\jackson-databind-2.9.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\javax.validation\validation-api\2.0.1.Final\cb855558e6271b1b32e716d24cb85c7f583ce09e\validation-api-2.0.1.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.0.1.Final\71e1cff3fcb20d3b3af4f3363c3ddb24d33c6879\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.3.2.Final\3789d00e859632e6c6206adc0c71625559e6e3b0\jboss-logging-3.3.2.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.3.4\3d5f48f10bbe4eb7bd862f10c0583be2e0053c6\classmate-1.3.4.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.8.13\ad94df2a28d658a40dc27bbaff6a1ce5fbf04e9b\aspectjweaver-1.8.13.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\2.7.9\a83113d2c091d0d0f853dad3217bd7df3beb6ae3\HikariCP-2.7.9.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.hibernate.javax.persistence\hibernate-jpa-2.1-api\1.0.2.Final\52afb5762c704a6b586e27742470c08f91877fc1\hibernate-jpa-2.1-api-1.0.2.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.javassist\javassist\3.22.0-GA\3e83394258ae2089be7219b971ec21a8288528ad\javassist-3.22.0-GA.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.jboss\jandex\2.0.3.Final\bfc4d6257dbff7a33a357f0de116be6ff951d849\jandex-2.0.3.Final.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\dom4j\dom4j\1.6.1\5d3ccc056b6f056dbf0dddfdf43894b9065a8f94\dom4j-1.6.1.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.10.0\f7e631ccf49cfc0aefa4a2a728da7d374c05bd3c\log4j-to-slf4j-2.10.0.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.25\af5364cd6679bfffb114f0dec8a157aaa283b76\jul-to-slf4j-1.7.25.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.25\da76ca59f6a57ee3102f8f9bd9cee742973efa8a\slf4j-api-1.7.25.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.0.10.RELEASE\8d6a766be91ae5613f2828eb9f77739a47ceb357\spring-jcl-5.0.10.RELEASE.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.9.0\7c10d545325e3a6e72e06381afe469fd40eb701\jackson-annotations-2.9.0.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.9.7\4b7f0e0dc527fab032e9800ed231080fdc3ac015\jackson-core-2.9.7.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\ccc\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.10.0\fec5797a55b786184a537abd39c3fa1449d752d6\log4j-api-2.10.0.jar com.test.zhuq.test01.Test01Application

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.6.RELEASE)

2018-11-21 12:54:44.720  INFO 5092 --- [           main] com.test.zhuq.test01.Test01Application   : Starting Test01Application on zhuq with PID 5092 (D:\my\test01\springboot\out\production\classes started by ccc in D:\my\test01\springboot)
2018-11-21 12:54:44.726  INFO 5092 --- [           main] com.test.zhuq.test01.Test01Application   : No active profile set, falling back to default profiles: default
2018-11-21 12:54:44.879  INFO 5092 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@fdefd3f: startup date [Wed Nov 21 12:54:44 CST 2018]; root of context hierarchy
2018-11-21 12:54:47.936  INFO 5092 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2018-11-21 12:54:49.179 ERROR 5092 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1074) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3590) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2531) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2301) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.24.jar:na]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_191]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_191]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_191]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) ~[mysql-connector-java-5.1.24.jar:na]
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317) ~[mysql-connector-java-5.1.24.jar:na]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117) ~[HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:123) ~[HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:365) ~[HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:194) ~[HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:460) [HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:534) [HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) [HikariCP-2.7.9.jar:na]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-2.7.9.jar:na]
    at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:151) [spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) [spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) [spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319) [spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaDat

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值