Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep linux下mysql修改连接超时wait_timeout修改后就ok了
Linux下mysql修改连接超时wait_timeout
1,首先:
show variables like '%timeout%';
显示结果:
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 3600 |
| wait_timeout | 28800 |
+-----------------------------+----------+
12 rows in set (0.00 sec)
其中有用的是: interactive_timeout 和wait_timeout 为28800,默认为8小时设置;
一般线上的环境中mysql中连接时间设置为7天即可;
2,其次:
执行命令: set interactive_timeout=604800;
set wait_timeout=604800;
最后:执行show variables like '%timeout%';看看执行成功没有,显示结果为:
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 604800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 3600 |
| wait_timeout | 604800 |
+-----------------------------+----------+
12 rows in set (0.00 sec)
表明执行成功了。。。
Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep linux下mysql修改连接超时wait_timeout修改后就ok了的更多相关文章
- org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open con
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session f ...
- 解决Could not open Hibernate Session for transaction; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionContext
我使用的是5.2.8的hibernate的jar包,运行的时候却报错Could not open Hibernate Session for transaction; nested exception ...
- 解决Exception:Could not open Hibernate Session for transaction; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionContext
原因是配置文件中 <bean id="transactionManager" class="org.springframework.orm.hibernate4.H ...
- 异常:getHibernateFlushMode is not valid without active transaction; nested exception is org.hibernate.HibernateException: getHibernateFlushMode is not valid without active transaction getHibernateFlu
场景: 在使用spring整合hibernate调用的HibernateTemplate时报错解决: 在spring配置文件中添加事务的配置 <bean id="hibernateTr ...
- Exceprtion:e createQuery is not valid without active transaction; nested exception is org.hibernate.HibernateException: createQuery is not valid without active transaction
如果增加配置了current_session_context_class属性,查询的时候需要session.beginTrasaction()来开启事务
- Could not open Hibernate Session for transaction;
javax.servlet.ServletException: org.springframework.transaction.CannotCreateTransactionException: Co ...
- SSH项目过一段时间之后再访问会报一次Could not open Hibernate session for transaction 异常,Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlyi,再重新方法即可访问成功(通常出现在过了一晚之后再去访问系统)
前端时间到客户那去进行项目的上线测试,将项目部署好之后,运行都是正常的,可是每到了第二天早上访问的时候,就会报一个Could not open Hibernate session for transa ...
- Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Cannot open connection
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceE ...
- Hibernage错误:Could not open Hibernate Session for transaction
今天客户发来的错误,是SSH框架做的项目,是用户在登陆时候出现的错误,但刷新之后就没问题. 提示错误:Could not open Hibernate Session for transaction. ...
随机推荐
- For循环的几个练习
1.括号里面只能放加或减,如果要使等式成立,括号里面应该放什么运算符12()34()56()78()9 = 59 2.蓝球弹起的高度篮球从10米高的地方落下,每次弹起的高度是原来的0.3倍,问弹跳10 ...
- dxSkinController1 皮肤使用
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...
- ZOJ 1276 DP
给出一系列的1x2的矩阵,要你求出矩阵以什么样的次序相乘才使得相乘次数最少,.(不用排序,只要决定该矩阵是和前面相乘比较好,还是后面). 今天仔细想了一下,跟之前做的DP题目做了下对比,你比如说猴子堆 ...
- SQL基础教程(第2版)第8章 SQL高级处理:练习题
本题中 SELECT 语句的含义是“按照商品编号(product_id)的升序进行排序, 计算出截至当前行的最高销售单价”.因此,在显示出最高销售单价的同时,窗口函 数的返回结果也会变化.这恰好和奥运 ...
- 201771010123汪慧和《面向对象程序设计JAVA》第六周实验总结
一.理论部分: 1.继承 用已有类来构建新类的一种机制.当定义了一个新类继承了一个类时,这个新类就继承了这个类的方法和域,同时在新类中添加新的方法和域以适应新的情况. 2.类.超类.子类 (1)类继承 ...
- 主席树--动态区间第k小
主席树--动态区间第\(k\)小 模板题在这里洛谷2617. 先对几个问题做一个总结: 阅读本文需要有主席树的基础,也就是通过区间kth的模板题. 静态整体kth: sort一下找第k小,时间复杂度\ ...
- 计算机网络(2): http的基础上用SSL或TSL加密
加密过程具体TCP实现 步骤 1 : 客户端通过发送Client Hello报文开始SSL通信(这里是在TCP的三次握手已经完成的基础上进行的).报文中包含客户端支持的SSL的指定版本.加密组件列表( ...
- python版本,执行
01. 第一个 HelloPython 程序 1.1 Python 源程序的基本概念 Python 源程序就是一个特殊格式的文本文件,可以使用任意文本编辑软件做 Python 的开发 Python 程 ...
- 取石子游戏(gcd)
蒜头君和花椰妹在玩一个游戏,他们在地上将n颗石子排成一排,编号为1到n.开始时,蒜头君随机取出了2颗石子扔掉,假设蒜头君取出的2颗石子的编号为a, b.游戏规则如下,蒜头君和花椰妹2人轮流取子,每次取 ...
- Java 中的接口有什么作用?以及接口和其实现类的关系?
Java 中的接口有什么作用? - Ivony的回答 - 知乎 https://www.zhihu.com/question/20111251/answer/16585393 这是一个初学者非常常见的 ...