无法获得连接,池错误超时等待空闲对象:sakai

时间:2014-02-20 07:33:25

标签: connection-pooling apache-commons-dbcp sakai

iam使用sakai 2.9.1 经过几次操作后,服务器停止响应并打印日志: -

2014-02-20 12:48:47,085 WARN http-bio-8080-exec-18 org.sakaiproject.db.impl.BasicSqlService - Sql.dbRead: sql: select SAKAI_SITE.SITE_ID,SAKAI_SITE.TITLE,SAKAI_SITE.TYPE,SAKAI_SITE.SHO 
RT_DESC,SAKAI_SITE.DESCRIPTION,SAKAI_SITE.ICON_URL,SAKAI_SITE.INFO_URL,SAKAI_SITE.SKIN,SAKAI_SITE.PUBLISHED,SAKAI_SITE.JOINABLE,SAKAI_SITE.PUBVIEW,SAKAI_SITE.JOIN_ROLE,SAKAI_SITE.IS_SPE
CIAL,SAKAI_SITE.IS_USER,SAKAI_SITE.CREATEDBY,SAKAI_SITE.MODIFIEDBY,SAKAI_SITE.CREATEDON,SAKAI_SITE.MODIFIEDON,SAKAI_SITE.CUSTOM_PAGE_ORDERED,SAKAI_SITE.IS_SOFTLY_DELETED,SAKAI_SITE.SOFT
LY_DELETED_DATE from SAKAI_SITE where ( SITE_ID = ? ) !admin 
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object 
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104) 
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
        at org.sakaiproject.db.impl.BasicSqlService.borrowConnection(BasicSqlService.java:260) 
        at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:540) 
        at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:341) 
        at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:321) 
        at org.sakaiproject.site.impl.DbSiteService$DbStorage.get(DbSiteService.java:236) 
        at org.sakaiproject.site.impl.BaseSiteService.getDefinedSite(BaseSiteService.java:616) 
        at org.sakaiproject.site.impl.BaseSiteService.getSite(BaseSiteService.java:702) 
        at org.sakaiproject.site.impl.BaseSiteService.getSiteVisit(BaseSiteService.java:780) 
        at org.sakaiproject.site.cover.SiteService.getSiteVisit(SiteService.java:140) 
        at org.sakaiproject.presence.tool.PresenceTool.doGet(PresenceTool.java:141) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:634) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) 
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) 
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:369) 
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) 
        at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:511) 
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1470) 
        at org.sakaiproject.portal.charon.handlers.PresenceHandler.doPresence(PresenceHandler.java:140) 
        at org.sakaiproject.portal.charon.handlers.PresenceHandler.doGet(PresenceHandler.java:70) 
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:881) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:695) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) 
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) 
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) 
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) 
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
        at java.lang.Thread.run(Thread.java:619) 
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object 
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1167) 
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)

1 个答案:

答案 0 :(得分:2)

您可能需要增加连接池的大小。您可能还需要调整数据库的DBMS设置。以下是您将用于控制数据库池的Sakai配置文件(通常为sakai.properties)的设置。

# The initial number of connections that are created when the pool is started
initialSize@javax.sql.BaseDataSource=10
# The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
maxActive@javax.sql.BaseDataSource=50
# The maximum number of active connections that can remain idle in the pool, without extra ones being released, or zero for no limit.
maxIdle@javax.sql.BaseDataSource=5
# The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none.
minIdle@javax.sql.BaseDataSource=5