java.sql.SQLException: connection holder is null 问题处理

问题描述

上上个周测试的时候突然报系统异常,于是我立即查看日志,发现是一个数据库异常:java.sql.SQLException: connection holder is null
我第一想到的就是可能是那种概率很小的突发事件,然后就和测试说没关系只是数据库连接异常以后应该没事,然后项目因为更新重启后也没有什么问题,直到第二天有一次出现这个问题,这时候我才意识到这个不是突发事件。肯定是系统问题。

解决方案

  1. 发现问题后开始去网上找,结果发现是druid连接池的问题,而网上好多对于这种问题的解决方案都是修改配置文件,但是我去看配置文件无需修改,然后去各种查找依然没有找到,然后当天只能靠重启解决问题。第三天继续查找问题,还是无果,但是晚上回去分析问题,以前都没有出现过这个问题怎么突然出现了这个问题,初步判断应该是最近更新代码的问题,于是第二天上午,将新合并的代码挨个重新检查一遍,真的发现一个问题是,其他同事使用编程式事务失败的时候没有回滚,其实这个问题早就应该想到了,出现这个问题的同时还有测试反应更新的数据多次查询一直在变化,其实这个就是事务没有提交的问题,在之前的公司我遇到过这样的问题,不过这个问题修改数据的时候都会报一个锁等待超时错误,结果我并没有找到这个错误,所以当时也没有朝这个方向去想。
  2. 当发现可能是事务未提交造成的问题,我也模拟一下,但是都是产生的锁等待超时问题,但是修改正确以后测试了一个周都没有在出现那个问题,可以确定是由于事务问题造成的。

反思总结

  1. 这个问题也可以发现自己好多的问题,从发现问题开始并没有进行细致的思考,想当然的定义问题
  2. 在该问题过程中对待一些伴随出现的问题视而不见,没有将其联系到一起去考虑分析问题
  3. 目前还没有具备分析源码的能力。导致出现框架问题只能去猜,去看别人如何解决。

原文地址:https://www.cnblogs.com/chunyun/p/12021570.html

时间: 2024-08-29 18:12:02

java.sql.SQLException: connection holder is null 问题处理的相关文章

java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

org.springframework.dao.TransientDataAccessResourceException: ### Error updating database. Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed ### The error may involve defaultParameterMap ### T

java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect

java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect 2014年06月29日 ⁄ 综合 ⁄ 共 637字 ⁄ 字号 小 中 大 ⁄ 评论关闭 java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server": j

HiveServer2 的jdbc方式创建udf的修改(add jar 最好不要使用),否则会造成一场 java.sql.SQLException: Error while processing statement: null

自从Hive0.13.0开始,使用HiveServer2 的jdbc方式创建udf的临时函数的方法由: ADD JAR ${HiveUDFJarPath} create TEMPORARY function md5  as 'com.hugedata.hive.udf.codec.UDFMd5'; 改为:     create TEMPORARY function md5  as 'com.hugedata.hive.udf.codec.UDFMd5' USING JAR ${HiveUDFJa

java.sql.SQLException: 调用中无效的参数DSRA0010E: SQL 状态 = null,错误代码 = 17,433

在节点 cnshh171Node01 上的服务器 server1 上,对数据源 testj2cbug 执行的测试连接操作由于以下异常 java.sql.SQLException: 调用中无效的参数DSRA0010E: SQL 状态 = null,错误代码 = 17,433 而失败. 查看 JVM 日志 JVM 日志: java.sql.SQLException: invalid arguments in call DSRA0010E: SQL State = null, Error Code =

java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQL server"

java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server": 表示该对象不是远程对象,不能通过该对象远程访问数据 解决: 方案一:改表: use mysql ;select user,host,password from user; update user set host = '%' where user='root'; 方

Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connectio

严重: StandardWrapper.Throwableorg.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

问题描述: 在使用JDBC连接数据库的时候,报错: java.sql.SQLException: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决方案: 经检查,是由于连接的URL写错导致,原URL:"jdbc:oracle:thin:@localhost:152

JDBC报错 消息 Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'

今天用JDBCTemplate时,发现启动服务器之后报错: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'. 网上说是因为MySQL版本过高的问题,我的MySQL版本是8.0,里面已经没有tx_isolation,变成了transaction_isolation,用了以下几种解决方法: (1)更改MySQL  无效,仍然

nested exception is java.sql.SQLException: IO 错误

1.错误描述 (mx.messaging.messages::ErrorMessage)#0 body = (null) clientId = "18CE3B03-9709-9DA8-7634-340C23317FDD" correlationId = "3161DF25-D056-D694-E5CF-963E4FE036D9" destination = "waitController" extendedData = (null) faultC