当前位置: 首页 > news >正文

mysql 6.0 jar_maven搭建ssm框架是使用最新mysql 6.0jar遇到的问题

今天学习SSM框架整合,完成Spring和mybatis这两大框架的整合做测试时候出来很多问题,主要来自于配置文件。

我这里重点说一下Mysql数据驱动配置。

配置pom.xml时候去网站 MySQL Connector/J 找到了最新版本,也是出于好奇就配置了...

mysql

mysql-connector-java

6.0.4

解决问题

原来新版的驱动配置有些变化:

1. url连接必须设置时区

### MySQL Connector/J 5.x (旧版连接)

#jdbc.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8

### MySQL Connector/J 6.x (新版连接)

jdbc.url=jdbc:mysql:///test?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false

说明: 新版驱动url默认地址为127.0.0.1:3306,所以访问本机mysql数据库地址可以用 /// 表示。

2. 的驱动类位置有了变化(不影响使用,但会报警告)

### MySQL Connector/J 5.x (旧版驱动)

#jdbc.driver_class=com.mysql.jdbc.Driver

### MySQL Connector/J 6.x (新版驱动)

jdbc.driver_class=com.mysql.cj.jdbc.Driver

异常查看

[INFO] Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgev419te1s9xe1nd08ye|1a79131, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgev419te1s9xe1nd08ye|1a79131, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/ssm?useSSL=false, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

[WARNING] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1eb28fe -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:69)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1606)

at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:633)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)

at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)

at com.mysql.cj.jdbc.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:118)

at com.mysql.cj.mysqla.MysqlaSession.configureTimezone(MysqlaSession.java:293)

at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:2399)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1739)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)

... 12 more

[WARNING] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@1e877aa is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.

一月 26, 2018 9:23:48 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [springmvc] in context with path [/maven_ssm_01] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!] with root cause

com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)

at com.mysql.cj.jdbc.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:118)

at com.mysql.cj.mysqla.MysqlaSession.configureTimezone(MysqlaSession.java:293)

at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:2399)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1739)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)

at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:633)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)

at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

[WARNING] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1f869cf -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:69)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1606)

at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:633)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)

at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)

at com.mysql.cj.jdbc.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:118)

at com.mysql.cj.mysqla.MysqlaSession.configureTimezone(MysqlaSession.java:293)

at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:2399)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1739)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)

... 12 more

[WARNING] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@1e877aa is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.

[WARNING] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1dd8d61 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:69)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1606)

at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:633)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)

at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)

at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)

at com.mysql.cj.jdbc.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:118)

at com.mysql.cj.mysqla.MysqlaSession.configureTimezone(MysqlaSession.java:293)

at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:2399)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1739)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)

... 12 more

[WARNING] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@1e877aa is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.

相关文章:

  • rhel7最小化安装 mysql_安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(二)
  • 链接索引 mysql_mysql索引
  • linux c epoll mysql_epoll简介和使用
  • python可以不对变量初始化_Python的诡异陷阱
  • python怎么绘制图例_用Python绘制图例
  • centos7安装mysql5.7.23_centos7.1上安装Mysql5.7.23
  • java客户端_大家都是怎么发布Java客户端程序的?难道让用户自己装JRE?
  • java 加载jar_java – 在运行时加载jar
  • java ant linux_linux下ant的安装
  • java获取数据库信息_java获取数据库的库、表、字段信息
  • java jpanel 布局管理器,JPanel和Java布局管理器
  • java 验证码识别 类库_iCaptcha
  • java调用wsdl证书错误_java调用.net web service服务,报证书错误
  • mysql 联表删除limit_MySQL联结多表更新和删除_mysql
  • mysql数据库备份总结_mysql中mysqlhotcopy备份数据库总结
  • 【108天】Java——《Head First Java》笔记(第1-4章)
  • 【跃迁之路】【669天】程序员高效学习方法论探索系列(实验阶段426-2018.12.13)...
  • 07.Android之多媒体问题
  • co模块的前端实现
  • ECMAScript6(0):ES6简明参考手册
  • HTTP 简介
  • Java多态
  • linux学习笔记
  • Next.js之基础概念(二)
  • supervisor 永不挂掉的进程 安装以及使用
  • WinRAR存在严重的安全漏洞影响5亿用户
  • 从@property说起(二)当我们写下@property (nonatomic, weak) id obj时,我们究竟写了什么...
  • 大数据与云计算学习:数据分析(二)
  • 基于OpenResty的Lua Web框架lor0.0.2预览版发布
  • 基于Vue2全家桶的移动端AppDEMO实现
  • 那些年我们用过的显示性能指标
  • 前端设计模式
  • 区块链共识机制优缺点对比都是什么
  • 算法-图和图算法
  • 微信端页面使用-webkit-box和绝对定位时,元素上移的问题
  • 怎样选择前端框架
  • LevelDB 入门 —— 全面了解 LevelDB 的功能特性
  • #laravel 通过手动安装依赖PHPExcel#
  • $(function(){})与(function($){....})(jQuery)的区别
  • (C++17) std算法之执行策略 execution
  • (SpringBoot)第七章:SpringBoot日志文件
  • (附源码)springboot人体健康检测微信小程序 毕业设计 012142
  • (论文阅读23/100)Hierarchical Convolutional Features for Visual Tracking
  • (没学懂,待填坑)【动态规划】数位动态规划
  • (转)机器学习的数学基础(1)--Dirichlet分布
  • (转载)从 Java 代码到 Java 堆
  • ../depcomp: line 571: exec: g++: not found
  • .net core使用RPC方式进行高效的HTTP服务访问
  • .NET 事件模型教程(二)
  • .NET 同步与异步 之 原子操作和自旋锁(Interlocked、SpinLock)(九)
  • .NET 中的轻量级线程安全
  • .net 桌面开发 运行一阵子就自动关闭_聊城旋转门家用价格大约是多少,全自动旋转门,期待合作...
  • .Net(C#)常用转换byte转uint32、byte转float等
  • .NET框架类在ASP.NET中的使用(2) ——QA
  • .NET使用HttpClient以multipart/form-data形式post上传文件及其相关参数