问题描述
页面下载一个Excel文件,使用struts1.2的action,Action类如下publicclassSjqyDaochuActionextendsAction{privatestaticfinalLoggerlogger=Logger.getLogger(SjqyDaochuAction.class);@SuppressWarnings("unchecked")publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequestreq,HttpServletResponseres)throwsException{SjqyFormsf=(SjqyForm)form;Stringtablename=sf.getTABLENAME();//导出excle名称StringdownFileName=tablename+"_kh.xls";Connectionconnection=null;DBConnectionMgrdbMgr=newcn.com.ebis.frame.utility.DBConnectionMgr();try{connection=dbMgr.getConnection();cn.com.ebis.commons.dao.CommDaodao=newcn.com.ebis.commons.dao.CommDao(connection);//生成Excel文件......returnnull;}catch(Exceptionex){logger.error("execute(ActionMapping,ActionForm,HttpServletRequest,HttpServletResponse)",ex);thrownewGeneralException("导出Excel出错!",ex);}finally{if(connection!=null)try{connection.close();}catch(SQLExceptione){logger.error("execute(ActionMapping,ActionForm,HttpServletRequest,HttpServletResponse)",e);//$NON-NLS-1$}}}}
客户下载的时候,后台报错,weblogic日志提示数据库连接泄露,log日志如下Forciblyreleasinginactiveconnection"weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@4b30"backintotheconnectionpool"csdb1",currentlyreservedby:java.lang.Exceptionatweblogic.jdbc.common.internal.ConnectionEnv.setup(ConnectionEnv.java:308)atweblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:314)atweblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:292)atweblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:425)atweblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:316)atweblogic.jdbc.common.internal.MultiPool.searchHighAvail(MultiPool.java:383)atweblogic.jdbc.common.internal.MultiPool.findPool(MultiPool.java:176)atweblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:87)atweblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:106)atweblogic.jdbc.pool.Driver.connect(Driver.java:149)atweblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:642)atweblogic.jdbc.jts.Driver.connect(Driver.java:124)atweblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:338)atcn.com.ebis.frame.utility.DBBean.initConnection(DBBean.java:81)atcn.com.ebis.frame.utility.DBBean.<init>(DBBean.java:47)atcn.com.ebis.frame.utility.DBConnectionMgr.getConnection(DBConnectionMgr.java:125)atcn.com.pansky.hnds.sjqy.cmd.SjqyDaochuAction.execute(SjqyDaochuAction.java:59)atorg.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)atorg.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)atorg.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)atorg.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:727)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:820)atweblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)atweblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)atweblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)atweblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcn.com.ebis.e5s.query.user.LeoRequestProcesser.doFilter(LeoRequestProcesser.java:59)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcn.com.pansky.util.grantmanager.QueryDataFilter.doFilter(QueryDataFilter.java:44)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcn.com.pansky.multisession.filter.MultiSessionFilter.process(MultiSessionFilter.java:82)atcn.com.pansky.multisession.filter.IntercurrentControlFilter.process(IntercurrentControlFilter.java:100)atcn.com.pansky.multisession.filter.MultiSessionFilter.doFilter(MultiSessionFilter.java:70)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcn.com.pansky.pw.utils.LogonFilter.doFilter(LogonFilter.java:66)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcn.com.pansky.frame.log.web.WebLogFilter.doFilter(WebLogFilter.java:67)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atweblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(UnknownSource)atweblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)atweblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)atweblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)atweblogic.work.ExecuteThread.execute(ExecuteThread.java:201)atweblogic.work.ExecuteThread.run(ExecuteThread.java:173).
请各位看一下这个问题出现的原因是什么,因为DBConnectionMgr是平台写的一个工具类,应该不会有问题,但是在Action中已经把链接关闭了,怎么还是会报错呢?谢谢!!!
解决方案
本帖最后由 javacow 于 2010-11-27 15:52:57 编辑
解决方案二:
或许不是关闭错误只是并发量太大了超负荷了呢?
解决方案三:
有可能是这个原因引用1楼mopishv0的回复:
或许不是关闭错误只是并发量太大了超负荷了呢?
解决方案四:
并发量不大。最多的时候也就几十个