- 浏览: 41588 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
paven:
根本无效的好吗
Log4j 动态更新配置文件【热配置】 -
nicegege:
恳请楼主多给点给力的代码例子。
JAVA数据结构 -
freezingsky:
我觉得,还不如直接讲数据结构,同时,再配合JDK现有的工具类, ...
JAVA数据结构 -
xulonghui2011:
xstream 比较好 这个需要自己构建节点,有点麻烦
dom4j 生成XML文件 -
gugu_abrams:
liuyuhua0066 写道冲着是Hashtable 而不是 ...
Hashtable和HashMap的区别
系统运行了一晚上,第二天早上没有其他操作,直接打开IE浏览器登录报错:
错误信息:
问题产生的根本原因在于系统到数据库的连接长时间没活动,MYSQL数据库连接因超时而断开,从而通过hibernate访问时报错...
解决办法:配置c3p0的反空闲设置idle_test_period,重新获取连接就可以了
注意:c3p0.idle_test_period的值小于c3p0.timeout的值
JDBC.properties配置
Spring中配置
提示信息
错误信息:
HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was52796 milliseconds ago.The last packet sent successfully to the server was 52796 milliseconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:596) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) $Proxy11.isUserExist(Unknown Source) com.founder.esb.monitor.web.manager.user.action.LoginAction.login(LoginAction.java:77) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) root cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was52796 milliseconds ago.The last packet sent successfully to the server was 52796 milliseconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) java.lang.reflect.Constructor.newInstance(Constructor.java:513) com.mysql.jdbc.Util.handleNewInstance(Util.java:406) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3270) com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1932) com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101) com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548) com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477) com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422) com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3131) com.mchange.v2.c3p0.impl.NewProxyConnection.getTransactionIsolation(NewProxyConnection.java:1037) sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74) $Proxy18.getTransactionIsolation(Unknown Source) org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:190) org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:508) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) $Proxy11.isUserExist(Unknown Source) com.founder.esb.monitor.web.manager.user.action.LoginAction.login(LoginAction.java:77) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
问题产生的根本原因在于系统到数据库的连接长时间没活动,MYSQL数据库连接因超时而断开,从而通过hibernate访问时报错...
解决办法:配置c3p0的反空闲设置idle_test_period,重新获取连接就可以了
注意:c3p0.idle_test_period的值小于c3p0.timeout的值
JDBC.properties配置
user=root password=root c3p0.max_size=10 c3p0.min_size=5 c3p0.timeout=5000 c3p0.max_statements=100 c3p0.idle_test_period=3000 c3p0.acquire_increment=2
Spring中配置
<property name="idleConnectionTestPeriod" value="${c3p0.idle_test_period}"/>
评论
2 楼
Veromca-源代码
2013-05-18
MySQL官方不推荐使用autoReconnect=true,参见 http://bugs.mysql.com/bug.php?id=5020
1 楼
kjj
2013-05-17
, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
提示信息
相关推荐
这个项目标题提及的是一个结合了MySQL数据库实现简单用户登录功能的SSH整合案例。下面我们将深入探讨SSH框架的核心原理以及在实际应用中的整合步骤。 **Struts框架**: Struts是基于MVC(Model-View-Controller)...
在信息技术领域,开发一款功能完备的商品管理系统是一项常见的实践任务,尤其对于学习和研究Java Web技术的学生来说,基于SSH(Struts2、Hibernate、Spring)框架加上MySQL数据库的商品管理系统是一个典型的实战项目...
4. **数据库连接**:在Spring配置文件中设置数据源和SessionFactory,用于管理数据库连接。 5. **用户服务接口与实现**:在Spring中定义一个`UserService`接口,包括登录验证方法。实现这个接口,使用Hibernate的...
3. MySQL数据库连接:可能包含使用SSH隧道创建安全连接到MySQL服务器的方法,以及如何使用mysql命令行工具进行数据库操作。 4. SQL基础知识:介绍SQL语言,包括SELECT语句、INSERT、UPDATE、DELETE等操作,以及如何...
【Struts2+Spring+Hibernate+MySQL整合】是企业级Java应用开发中常见的技术栈,也被称作SSH框架。这个组合提供了模型-视图-控制器(MVC)架构模式,数据库管理,以及依赖注入和事务控制的能力。下面将详细介绍这个...
这个项目可能是一个书籍管理系统的实例,其中包含了用户登录和注册功能,并且使用了MySQL数据库来存储用户信息。 首先,Spring是应用上下文和依赖注入(DI)框架,它允许我们管理对象和它们之间的依赖关系。在登录...
本文主要介绍了如何使用Navicat连接阿里云服务器上的MySQL数据库,并解决在连接过程中可能遇到的问题。 #### 二、准备工作 在开始之前,请确保已完成以下步骤: 1. 已经购买并配置好阿里云服务器实例。 2. 在服务器...
在使用MySQL数据库时,可能会遇到“Authentication Failed”错误,这通常意味着客户端在尝试连接数据库时认证失败。错误信息显示“Reading from the stream has failed”,表明在数据传输过程中存在问题。本篇文章将...
添加的规则允许新建连接通过相应的端口,同时保留了原有的SSH服务端口(22端口)规则。 3. SELinux安全模块的关闭: SELinux(安全增强型Linux)是Linux内核的一个安全模块,它能够对系统中的进程进行限制,防止其...
6. 配置文件:包括Struts2的struts.xml,Spring的applicationContext.xml,以及Hibernate的hibernate.cfg.xml,定义框架配置和数据库连接信息。 学习这个项目,你可以了解到如何集成SSH框架,如何设计数据库模型,...
标题中的"ssh.rar_SSH登录_ssh_ssh mysql_基于SSH"表明这个压缩包可能包含了关于如何使用SSH框架实现一个基于MySQL数据库的登录功能的资源。SSH框架通常包括以下组件: 1. **Spring**:这是一个全面的应用框架,...
在本文档中,Hibernate版本为3.6,初始化失败可能是由于JDBC驱动类未找到,需要添加`mysql-connector-java-5.0.4-bin.jar`驱动包。 【EXTJS4介绍】 EXTJS4是一个JavaScript前端框架,用于构建富客户端应用。它提供...
- **MySQL(3306端口)**:用于数据库连接。 - **SNMP(161端口)**:用于监控数据收集。 编辑`/etc/sysconfig/iptables`文件,添加以下规则: ```bash -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j...
在这个项目中,SSH2被用来实现登录验证功能,并且包含了一个模块的增删改查操作,这些功能都是基于MySQL数据库来实现的。 首先,我们来看看SSH2中的登录验证码功能。验证码是为了防止自动化程序或恶意攻击者通过...
4. 数据库导入:将项目中的数据库文件导入到MySQL或Oracle中,设置相应的连接配置。 5. 编译与打包:使用Maven或Gradle等工具编译源代码,生成WAR文件。 6. 部署应用:将WAR文件放入Tomcat的webapps目录下,启动...
MySQL数据库的管理中,修改root用户的密码是一项基本且重要的任务,因为root用户具有最高权限,可以执行所有数据库操作。在WDCP(Web Disk Control Panel)这样的服务器管理面板中,正确管理root密码对于创建和管理...
在IT领域,远程数据库连接是常见的操作,尤其是在分布式系统、云计算和数据分析中。Navicat是一款强大的数据库管理工具,支持多种数据库类型,如MySQL、Oracle、SQL Server等,它允许用户通过图形化界面远程访问和...
哥们周日弄了一天要实现这个功能可是没有实现,无奈只能CSDN下载类似功能的实现,可是都...2.更新数据库的连接信息 3.生成数据库表,并导入附件数据库的文件 4.访问:/pcd/page 可以访问页面,体验交互 5.请回来点赞!
6. **错误处理**:在编写代码时,确保包含适当的错误处理机制,以应对连接失败、认证错误或其他网络问题。 至于“struts2”,它是一个基于MVC(Model-View-Controller)设计模式的Java Web框架,用于构建动态网站。...
MySQL for Visual Studio 是一款专为Visual Studio开发者设计的集成工具,它提供了在.NET环境中与MySQL数据库交互的强大功能。版本2.0.5是非安装版,意味着用户可以直接解压使用,无需通过传统安装程序进行安装,...