Bug
一只努力的笨笨熊
这个作者很懒,什么都没留下…
展开
-
Redis执行save命令时报错ERR
问题描述Redis-Cli执行save命令报错ERR,且并未产生rdb文件原因分析:启动redis-server服务时,没有root权限解决方案:sudo kill -9 pid #将redis服务杀掉sudo redis-server ***/redis.config #sudo使用root权限启动...原创 2022-04-06 17:31:36 · 2090 阅读 · 0 评论 -
Mysql5.6报错1040 Too many connections的解决方法
错误代码1040,Too many connections字面意思就是连接数太多,原因有两种:确实跑的程序较多,出现连接数太多(如一台服务器上跑很多项目造成)自己写的程序代码本身有问题,可查找问题原因本文记录上述第一种情况,确为工作中所遇见,在此记录。mysql安装目录为D:\mysql-5.6.24-win32在目录为D:\mysql-5.6.24-win32\bin中允许cmd后执行下面命令查看当前最大连接数mysqlshow variables like '%max_connec原创 2022-03-25 16:43:50 · 6143 阅读 · 0 评论 -
SpringBoot中添加拦截器,在拦截器中注入其他类的时候出现空指针异常解决办法
拦截器代码/** * * 记录用户轨迹 */@Componentpublic class AdminInterceptor implements HandlerInterceptor { @Autowired SysLogDao sysLogDao /** * 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作) */ @Override public voi原创 2021-07-22 17:03:46 · 739 阅读 · 1 评论 -
SpringBoot使用@Autowired注入静态变量报空指针异常
问题:在编写发送邮件工具类MailUtil时,直接使用@Autowired静态注入JavaMailSender,运行时报空指针异常@Componentpublic class MailUtil { @Autowired private static JavaMailSender mailSender;} 原因分析:类变量(用static修饰)是属于类的,在spring容器中都是实例化对象,所以不能使用 @Autowired来注入静态变量解决方案:代码如下:@Com原创 2021-07-21 11:44:41 · 1698 阅读 · 0 评论 -
MySQL数据表不能修改、删除等操作,卡死、锁死情况的处理办法。
问题描述:MySQL如果频繁的修改一个表的数据,那么这么表会被锁死。造成假死现象。比如用Navicat等连接工具操作,Navicat会直接未响应,只能强制关闭软件,但是重启后依然无效。 解决方案:在MySql命令行中//首先执行:show processlist; //列出当前的操作process,一般会看到很多waiting的process,说明已经有卡住的proces了,我们要杀死process!!//再执行:kill processid; //processid表示proce原创 2021-07-15 14:07:25 · 2647 阅读 · 0 评论 -
java程序启动连接mysql时报错com.mysql.jdbc.exceptions.jdbc4.CommunicationsExcepti:Communications link failur
问题描述:报错如下:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstru原创 2021-01-15 11:25:37 · 2348 阅读 · 1 评论