java.sql.SQLException: No operations allowed after statement closed.

背景

某天下午,客服反馈线上服务出现问题,不能分配了。于是我登录到系统上,进行同样的操作发现也不行。当然同时我已经登录到服务器打开了日志,发现报错了,下面就是日志的错误信息:

java.sql.SQLException: No operations allowed after statement closed.at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:82)at com.mysql.cj.jdbc.ClientPreparedStatement.clearBatch(ClientPreparedStatement.java:287)at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:439)at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:794)at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:3101)at com.alibaba.druid.filter.FilterAdapter.statement_executeBatch(FilterAdapter.java:2506)at com.alibaba.druid.filter.FilterEventAdapter.statement_executeBatch(FilterEventAdapter.java:273)at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:3099)at com.alibaba.druid.filter.FilterAdapter.statement_executeBatch(FilterAdapter.java:2506)at com.alibaba.druid.filter.FilterEventAdapter.statement_executeBatch(FilterEventAdapter.java:273)at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:3099)at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeBatch(StatementProxyImpl.java:196)at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:551)at sun.reflect.GeneratedMethodAccessor2252.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:78)at com.sun.proxy.$Proxy716.executeBatch(Unknown Source)at com.baomidou.mybatisplus.core.executor.MybatisBatchExecutor.doFlushStatements(MybatisBatchExecutor.java:135)at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.flushStatements(MybatisCachingExecutor.java:218)at sun.reflect.GeneratedMethodAccessor3312.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)at com.sun.proxy.$Proxy713.flushStatements(Unknown Source)at sun.reflect.GeneratedMethodAccessor3312.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)at com.sun.proxy.$Proxy713.flushStatements(Unknown Source)at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:252)at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.lambda$executeBatch$0(SqlHelper.java:217)at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:179)at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:211)at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:239)at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.saveBatch(ServiceImpl.java:135)at com.baomidou.mybatisplus.extension.service.IService.saveBatch(IService.java:73)at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)at com.abc.services.oa.oaHouseBrokerRel.service.impl.OaHouseBrokerRelServiceImpl$$EnhancerBySpringCGLIB$$e2d73fd6.saveBatch(<generated>)at com.abc.services.oa.oaHouseBrokerRel.service.impl.OaHouseBrokerRelServiceImpl.saveRelBatch(OaHouseBrokerRelServiceImpl.java:132)at com.abc.services.oa.oaHouseBrokerRel.service.impl.OaHouseBrokerRelServiceImpl.saveRel(OaHouseBrokerRelServiceImpl.java:58)at com.abc.services.oa.oaHouseBrokerRel.service.impl.OaHouseBrokerRelServiceImpl$$FastClassBySpringCGLIB$$cc62fe90.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)at com.abc.services.oa.oaHouseBrokerRel.service.impl.OaHouseBrokerRelServiceImpl$$EnhancerBySpringCGLIB$$e2d73fd6.saveRel(<generated>)at com.abc.admin.controller.oa.oaHouseBrokerRel.OaHouseBrokerRelController.saveRel(OaHouseBrokerRelController.java:39)at sun.reflect.GeneratedMethodAccessor3543.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)at com.abc.common.log.LogFilter.doFilterInternal(LogFilter.java:68)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:750)
Caused by: com.mysql.cj.exceptions.StatementIsClosedException: No operations allowed after statement closed.at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:423)at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)at com.mysql.cj.jdbc.StatementImpl.checkClosed(StatementImpl.java:338)at com.mysql.cj.jdbc.ClientPreparedStatement.clearBatch(ClientPreparedStatement.java:282)... 101 common frames omitted

解决思路

我能正常登录,正常查询,说明并不是所有的操作都有问题。我执行的业务操作是insert操作,发现有问题,于是查看一下MySQL的连接信息:

show full processlist;

发现好多连接都被阻塞住了(下面的图片是问题解决后的结果,解决前的有很多State=Waiting for handler commit的

 查看MySQL的官方文档对该状态的解释:

  • waiting for handler commit

    The thread is waiting for a transaction to commit versus other parts of query processing.(与查询处理的其他部分相比,线程正在等待事务提交。)

 说明事务一直等待提交,为什么提交不了?我查看当时的info一列,该列会显示正在执行的 SQL 查询或命令的详细信息。这些SQL语句也没什么不一样的,也不会有长事务等等。等把这些可能原因都过一遍之后,突然想到,有可能服务器磁盘空间满了,于是我到服务器上执行:

df -h

发现已经没有剩余空间了(当时使用已经100%,已经没有可用空间了)

于是通过以下命令查看常用文件夹下的目录文件大小:

du -sh /abc

发现日志文件过多,太大了,于是清空日志文件

> a.log

随后再通过:show full processlist;命令去查看,发现事务都已经正常提交了,系统也已经恢复了正常。

总结

  • 服务器使用情况监控(需要完善)
  • 定期清理日志文件(需要完善)
  • 预警机制(需要完善)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/475958.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

五、Mybatis复杂映射开发

1.一对一查询 1.1 一对一查询的模型 用户表和订单表的关系为&#xff0c;一个用户有多个订单&#xff0c;一个订单只从属于一个用户一对一查询的需求&#xff1a;查询一个订单&#xff0c;与此同时查询出该订单所属的用户SQL: DROP TABLE IF EXISTS user; CREATE TABLE user …

网络模型及传输基本流程

1.OSI 七层模型 OSI &#xff08; Open System Interconnection &#xff0c;开放系统互连&#xff09;七层网络模型称为开放式系统互联参考模型&#xff0c;是一个逻辑上的定义和规范; 把网络从逻辑上分为了 7 层 . 每一层都有相关、相对应的物理设备&#xff0c;比如路由器…

IDEA2021版热部署配置

第一步 Settings中搜索compiler 勾选上Build project automatically 第二步 按快捷键 CtrlAltShift/ 选择第一个Registry 勾选上 注&#xff1a;2021版IDEA 被迁移到了这里 第三步 第四步 pom.xml中添加 配置文件中添加 #springdevtools spring.devtools.restart.…

基于springboot智慧外贸平台源码和论文

网络的广泛应用给生活带来了十分的便利。所以把智慧外贸管理与现在网络相结合&#xff0c;利用java技术建设智慧外贸平台&#xff0c;实现智慧外贸的信息化。则对于进一步提高智慧外贸管理发展&#xff0c;丰富智慧外贸管理经验能起到不少的促进作用。 智慧外贸平台能够通过互…

svg之全局组件,配合雪碧图解决vue2的svg优化问题

这里是vue2中的svg的完整解决方案的另一篇。 <template><svg :class"svgClass"><use :xlink:href"#${name}"></use></svg> </template><script>export default {name: icon,props: {name: {type: String,requi…

167基于matlab的根据《液体动静压轴承》编写的有回油槽径向静压轴承的程序

基于matlab的根据《液体动静压轴承》编写的有回油槽径向静压轴承的程序&#xff0c;可显示承载能力、压强、刚度及温升等图谱.程序已调通&#xff0c;可直接运行。 167 显示承载能力、压强、刚度及温升 (xiaohongshu.com)https://www.xiaohongshu.com/explore/65d212b200000000…

IO进程线程day1作业

1、使用fgets统计给定文件行数 代码&#xff1a; #include<stdio.h> #include<string.h> #include<stdlib.h> int main(int argc, const char *argv[]) {if(argc ! 2){printf("inputs file error\n");printf("usage:./a.out filename\n&quo…

sonar-java 自定义规则

前言 最近在搞代码质量方面的项目&#xff0c;主要是针对Java语言&#xff0c;其他语言实际上也可以执行检查&#xff0c;核心原理是一样的&#xff0c;都是静态代码扫描&#xff0c;如果需要进行动态代码运行验证则可以通过单元测试的方式。以其中一个示例&#xff0c;实现自…

防火墙综合拓扑

要求&#xff1a; 1.办公区设备可以通过电信链路和移动链路上网(多对多的NAT&#xff0c;并且需要保留一个公网IP不能用来转换) 在FW1上 做安全策略 做NAT策略 这样&#xff0c;两条线就负载均衡了&#xff0c;并且相当于做了一个备份&#xff0c;一个断了就走另一条 2.分公司…

信息安全认证 | CISP证书怎么样?值得考吗?

HCIE考证研究所的朋友们&#xff0c;新年快乐&#xff01; 今天给大家说说CISP证书&#xff0c;新的一年祝大家逢考必过啊~ 01 考注册信息安全工程师证书的用处 CISP证书可作为学识和技能证明&#xff1b;求职、任职、晋升、加薪的资格凭证&#xff1b;用人单位招聘、录用劳动…

《富爸爸:巴比伦最富有的人》读书笔记

目录 作者简介 感悟 经典摘录 观点&#xff1a; 支付给自己(理解是投资自己) 观点&#xff1a;源源不断地放入金币 观点&#xff1a; 把收入的一部分留给我自己 观点&#xff1a; 从专业的人士得到建议 观点&#xff1a;一旦为自己规定了任务&#xff0c;就一定要完成 …

模型超参数寻优

参考某篇QSAR的sci论文设置 根据上图&#xff0c;我设置我的XGBoost模型&#xff1a; # 定义要搜索的超参数的候选值 param_grid {model__learning_rate: [0.1, 0.01, 0.001], # 调整学习率model__n_estimators: [50, 100, 200, 300,400,500], # 调整树的数量model__max_de…