项目中遇到的问题记录

  1. idea软件,新增的gradle项目在build的时候报SSL peer shut down incorrectly错误。
  • 解决方法:File → Settings → Experimental → Gradle → Only sync the active variant,取消选择,然后再sync同步

2.使用idea创建maven项目,导入jar报错:Unable to import maven project: See logs for details

解决思路:

  • 查看是否配置有maven环境变量
  • idea软件settings查看maven的环境配置,是否使用配置的maven插件,
  • idea软件查看maven的jdk版本

3.IDEA连接mysql5.7.26,报[08001] Could not create connection to database server.错误

  • 导致的原因是:MySQL版本过高
  • 解决方法:在数据库后面添加:useSSL+serverTimezone+characterEncoding+autoReconnect

即:jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=Hongkong&characterEncoding=utf-8&autoReconnect=true

4.项目连接数据库时候报如下的错误:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) ......

导致的原因:有可能是由mysql5数据库的配置引起的。mysql5将其连接的等待时间(wait_timeout)缺省为8小时。在其客户程序中可以这样来查看其值
解决方法:
查看连接等待的时间是多少:
mysql > show global variables like 'wait_timeout'; 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
  • 在文件my.ini的[mysqld] 命令下面的最后增加一行:wait_timeout=1814400
  • 重启mysql



原文地址:https://www.cnblogs.com/qianshouxiuluo/p/11953069.html