首页

异常"org.hibernate.exception.GenericJDBCException: could not execute query"解决方法

标签:GenericJDBCException,hibernate,SQLException     发布时间:2016-01-16   

一、问题现象

最近在使用平台PMS系统发布内容时,时常发送GenericJDBCException异常(如下),但是一刷新就又好了,比较诧异,具体如下

HTTP Status 500 -@b@@b@type Exception report@b@@b@message@b@@b@description The server encountered an internal error () that prevented it from fulfilling this request.@b@@b@exception@b@@b@javax.servlet.ServletException: org.hibernate.exception.GenericJDBCException: could not execute query@b@    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)@b@    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)@b@    com.iss.pms.util.LoginFilter.doFilter(LoginFilter.java:46)@b@@b@root cause@b@@b@org.hibernate.exception.GenericJDBCException: could not execute query@b@    org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)@b@    org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)@b@    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)@b@    org.hibernate.loader.Loader.doList(Loader.java:2220)@b@    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)@b@    org.hibernate.loader.Loader.list(Loader.java:2103)@b@    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)@b@    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:340)@b@    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)@b@    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1122)@b@    org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)@b@    com.iss.pms.dao.impl.UserDao.getUserMenus(UserDao.java:47)@b@    com.iss.pms.dao.impl.UserDao$$FastClassByCGLIB$$8f0e939f.invoke(<generated>)@b@    net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)@b@    org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)@b@    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@    org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@    org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)@b@    com.iss.pms.dao.impl.UserDao$$EnhancerByCGLIB$$5eb835de.getUserMenus(<generated>)@b@    com.iss.pms.service.impl.UserServer.getMenuJson(UserServer.java:245)@b@    com.iss.pms.web.action.LoginAction.login(LoginAction.java:98)@b@    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)@b@    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)@b@    java.lang.reflect.Method.invoke(Unknown Source)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)@b@    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)@b@    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)@b@    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)@b@    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)@b@    com.iss.pms.util.LoginFilter.doFilter(LoginFilter.java:46)@b@@b@root cause@b@@b@java.sql.SQLException: Connection oracle.jdbc.driver.OracleConnection@4d9119 is closed.@b@    org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:354)@b@    org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:246)@b@    org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)@b@    org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:528)@b@    org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:446)@b@    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:140)@b@    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1551)@b@    org.hibernate.loader.Loader.doQuery(Loader.java:673)@b@    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)@b@    org.hibernate.loader.Loader.doList(Loader.java:2217)@b@    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)@b@    org.hibernate.loader.Loader.list(Loader.java:2103)@b@    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)@b@    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:340)@b@    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)@b@    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1122)@b@    org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)@b@    com.iss.pms.dao.impl.UserDao.getUserMenus(UserDao.java:47)@b@    com.iss.pms.dao.impl.UserDao$$FastClassByCGLIB$$8f0e939f.invoke(<generated>)@b@    net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)@b@    org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)@b@    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@    org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)@b@    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@    org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)@b@    com.iss.pms.dao.impl.UserDao$$EnhancerByCGLIB$$5eb835de.getUserMenus(<generated>)@b@    com.iss.pms.service.impl.UserServer.getMenuJson(UserServer.java:245)@b@    com.iss.pms.web.action.LoginAction.login(LoginAction.java:98)@b@    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)@b@    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)@b@    java.lang.reflect.Method.invoke(Unknown Source)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)@b@    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)@b@    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)@b@    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)@b@    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)@b@    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)@b@    com.iss.pms.util.LoginFilter.doFilter(LoginFilter.java:46)@b@@b@note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.

二、解决步骤

1. 根据现象"一刷新就又好了"和GenericJDBCException,可以判断会话连接池有关系(应该需要优化其连接有效时间、连接数等参数)

2. 在根据“java.sql.SQLException: Connection oracle.jdbc.driver.OracleConnection@4d9119 is closed.”可以判断是使用的数据库连接已经关闭了,但是还进行了该连接的查询操作(com.iss.pms.dao.impl.UserDao.getUserMenus(UserDao.java:47)),如下所示代码段

46.      Query query = this.getHibernateSession().createQuery("from Menu ");

47       userMemuList = (List<Menu>)query.list();

3. 如上分析,session的查询对象生命周期有效的情况下,其对应的数据库连接编号4d9119被强行关闭,肯定数据库连接池参数到达上限造成的,现有配置参数如下

<bean id="dataSource"@b@        class="org.apache.commons.dbcp.BasicDataSource"  destroy-method="close">@b@         <property name="driverClassName" value="${jdbc.driverClassName}"/>@b@        <property name="url" value="${jdbc.url}"/>@b@        <property name="username" value="${jdbc.username}"/>@b@        <property name="password" value="${jdbc.password}"/>@b@        <property name="initialSize">@b@        <!-- 初始化连接数 -->@b@                <value>4</value>@b@        </property>@b@        <property name="maxIdle">@b@        <!-- 最大空闲连接 -->@b@               <value>8</value>@b@        </property>@b@        <property name="minIdle">@b@        <!-- 最小空闲连接 -->@b@               <value>6</value>@b@        </property>@b@        <property name="maxWait">@b@        <!-- 超时等待时间(毫秒) -->@b@               <value>120000</value>@b@        </property>@b@         <property name="maxActive">@b@         <!-- 最大连接数量 -->@b@               <value>10</value>@b@        </property>@b@        <property name="defaultAutoCommit">@b@                <value>true</value>@b@        </property>@b@        <property name="logAbandoned">@b@        <!-- 否在自动回收超时连接时打印连接的超时错误 -->@b@                <value>true</value>@b@        </property>@b@        <property name="removeAbandoned">@b@        <!-- 是否自动回收超时连接 -->@b@                <value>true</value>@b@        </property>@b@        <property name="removeAbandonedTimeout">@b@        <!-- 超时时间(秒) -->@b@                <value>120</value>@b@         </property>@b@          @b@        <property name="testOnReturn">@b@                <value>true</value>@b@        </property>@b@        <property name="testWhileIdle">@b@               <value>true</value>@b@        </property> @b@    </bean>

将最大连接数及超时、等待时间分别上调,具体改为为

<bean id="dataSource"@b@        class="org.apache.commons.dbcp.BasicDataSource"  destroy-method="close">@b@         <property name="driverClassName" value="${jdbc.driverClassName}"/>@b@        <property name="url" value="${jdbc.url}"/>@b@        <property name="username" value="${jdbc.username}"/>@b@        <property name="password" value="${jdbc.password}"/>@b@        <property name="initialSize">@b@        <!-- 初始化连接数 -->@b@                <value>4</value>@b@        </property>@b@        <property name="maxIdle">@b@        <!-- 最大空闲连接 -->@b@               <value>8</value>@b@        </property>@b@        <property name="minIdle">@b@        <!-- 最小空闲连接 -->@b@               <value>6</value>@b@        </property>@b@        <property name="maxWait">@b@        <!-- 超时等待时间(毫秒) -->@b@               <value>200000</value>@b@        </property>@b@         <property name="maxActive">@b@         <!-- 最大连接数量 -->@b@               <value>30</value>@b@        </property>@b@        <property name="defaultAutoCommit">@b@                <value>true</value>@b@        </property>@b@        <property name="logAbandoned">@b@        <!-- 否在自动回收超时连接时打印连接的超时错误 -->@b@                <value>true</value>@b@        </property>@b@        <property name="removeAbandoned">@b@        <!-- 是否自动回收超时连接 -->@b@                <value>true</value>@b@        </property>@b@        <property name="removeAbandonedTimeout">@b@        <!-- 超时时间(秒) -->@b@                <value>300</value>@b@         </property>@b@          @b@        <property name="testOnReturn">@b@                <value>true</value>@b@        </property>@b@        <property name="testWhileIdle">@b@               <value>true</value>@b@        </property> @b@    </bean>

4. 重启应用,一直没有再重新问题

<<热门下载>>