新手入门SSM开源项目遇到的一点Bug

  1. 使用IJEDA运行一个spring+spring mvc+mybats+Mysql的开源项目。

首先选择项目构建对应的方式

 

 

然后根据文件对应打开的方式

 

 

然后这个项目是通过pom.xml构建的,然后里面有许多依赖

选择自己需要的版本IJ就会提示导入。

  1. 遇到的异常

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: Cannot create PoolableConnectionFactory (Client does not support authentication protocol requested by server; consider upgrading MySQL client)

### The error may exist in jee/support/dao/AdminDao.xml

### The error may involve jee.support.dao.AdminDao.findByNameAndPwd

### The error occurred while executing a query

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Client does not support authentication protocol requested by server; consider upgrading MySQL client)

    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)

        org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

        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)

 

 

 

我首先看了第一句话Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Client does not support authentication protocol requested by server; consider upgrading MySQL client)

 

大致的意思是无法获得JDBC的连接,可能需要考虑MySQL客户端的升级。然后我查了一下我的版本基本是新的,然后发现我的依赖的数据库驱动包是旧的。

然后我上https://mvnrepository.com/上查询了最新的mysql-connector的版本,然后跟换版本,IJ自动提示import。

 

紧接着重启后再次爆出了异常!

 

### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (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.)

### The error may exist in jee/support/dao/AdminDao.xml

### The error may involve jee.support.dao.AdminDao.findByNameAndPwd

### The error occurred while executing a query

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (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.)

    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)

        org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

        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)

 

还是无法连接数据库Cannot create PoolableConnectionFactory这个异常,但这次提示的解决方案是不同的,希望我在JDBC中设置serverTimezone。然后我把Cannot create PoolableConnectionFactory贴到了百度,发现是因为Mysql 8.0不同于之前旧版本

之前的连接方式:

MySQL8.0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值