无法连接mysql The server time zone value '???ú±ê×??±??' 及Connections could not be acquired from ..
发布日期:2021-11-15 14:57:33 浏览次数:29 分类:技术文章

本文共 7174 字,大约阅读时间需要 23 分钟。

报错情况:

1.

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.

Tue May 15 21:38:04 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
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:127)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:61)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:71)
 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)

 

  原因 :mysql返回的时间有问题,比实际时间要早8小时

解决办法

[

jdbc.url=

jdbc.url=jdbc:mysql://127.0.0.1:3306/one?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false

]

2.

Message Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!### The error may exist in file [D:\biyesheji\target\xiaobao\WEB-INF\classes\mapper\UserMapper.xml]### The error may involve com.xiaobao.dao.UserDao.selectUser### The error occurred while executing a query### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)	javax.servlet.http.HttpServlet.service(HttpServlet.java:634)	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

Root Cause

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!### The error may exist in file [D:\biyesheji\target\xiaobao\WEB-INF\classes\mapper\UserMapper.xml]### The error may involve com.xiaobao.dao.UserDao.selectUser### The error occurred while executing a query### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!	org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)	org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)	com.sun.proxy.$Proxy19.selectList(Unknown Source)	org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)	org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)	org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)	org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)	com.sun.proxy.$Proxy20.selectUser(Unknown Source)	com.xiaobao.service.impl.UserServiceImpl.selectUser(UserServiceImpl.java:19)	com.xiaobao.controller.UserController.selectUserAsJson(UserController.java:33)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	java.lang.reflect.Method.invoke(Method.java:498)	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)	javax.servlet.http.HttpServlet.service(HttpServlet.java:634)	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

 

解决办法

1.检查配置文件

jdbc.driver=com.mysql.jdbc.Driver#数据库地址jdbc.url=jdbc:mysql://127.0.0.1:3306/one?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false#用户名jdbc.username=root#密码jdbc.password=1

2.数据库未启动或无权访问

3 项目未引入对应的驱动jar包mysql-connector-java-5.1.6-bin.jar

4 mysql root没有远程访问的权限

 

 

 

转载地址:https://blog.csdn.net/qq_39736176/article/details/82813122 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:nested exception is org.apache.ibatis.reflection.ReflectionException
下一篇:idea 连接 mysql

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月08日 13时58分37秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章