java.sql.SQLException: Already closed.

Sakai JIRA | Zhen Qian | 5 years ago
  1. 0

    We have seen many instances of bug reports containing similar error as follows: The random connection closed exception is documented with suggested code pattern from tomcat doc: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Random_Connection_Closed_Exceptions which I suggest we should do a code review across all Sakai code that uses db connection, and make sure the code never closes a connection twice. "stack trace: java.lang.Error: java.sql.SQLException: Already closed. at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:620) caused by: java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181) at org.sakaiproject.db.impl.BasicSqlService.returnConnection(BasicSqlService.java:276) at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:620) at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:340) at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:320) at org.sakaiproject.site.impl.DbSiteService$DbStorage.get(DbSiteService.java:237) at org.sakaiproject.site.impl.BaseSiteService.getDefinedSite(BaseSiteService.java:586) at org.sakaiproject.site.impl.BaseSiteService.getSite(BaseSiteService.java:672) at org.sakaiproject.site.impl.BaseSiteService.getSiteVisit(BaseSiteService.java:750) at org.sakaiproject.site.cover.SiteService.getSiteVisit(SiteService.java:134) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSiteVisit(PortalSiteHelperImpl.java:896) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getMyWorkspace(PortalSiteHelperImpl.java:698) at org.sakaiproject.portal.charon.site.AbstractSiteViewImpl.<init>(AbstractSiteViewImpl.java:99) at org.sakaiproject.portal.charon.site.SubSiteViewImpl.<init>(SubSiteViewImpl.java:58) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSitesView(PortalSiteHelperImpl.java:1135) at org.sakaiproject.portal.charon.SkinnableCharonPortal.includeSubSites(SkinnableCharonPortal.java:415) at org.sakaiproject.portal.charon.handlers.SiteHandler.doSite(SiteHandler.java:263) at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:125) at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:627) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:581) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:662) "

    Sakai JIRA | 5 years ago | Zhen Qian
    java.sql.SQLException: Already closed.
  2. 0

    We have seen many instances of bug reports containing similar error as follows: The random connection closed exception is documented with suggested code pattern from tomcat doc: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Random_Connection_Closed_Exceptions which I suggest we should do a code review across all Sakai code that uses db connection, and make sure the code never closes a connection twice. "stack trace: java.lang.Error: java.sql.SQLException: Already closed. at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:620) caused by: java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181) at org.sakaiproject.db.impl.BasicSqlService.returnConnection(BasicSqlService.java:276) at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:620) at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:340) at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:320) at org.sakaiproject.site.impl.DbSiteService$DbStorage.get(DbSiteService.java:237) at org.sakaiproject.site.impl.BaseSiteService.getDefinedSite(BaseSiteService.java:586) at org.sakaiproject.site.impl.BaseSiteService.getSite(BaseSiteService.java:672) at org.sakaiproject.site.impl.BaseSiteService.getSiteVisit(BaseSiteService.java:750) at org.sakaiproject.site.cover.SiteService.getSiteVisit(SiteService.java:134) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSiteVisit(PortalSiteHelperImpl.java:896) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getMyWorkspace(PortalSiteHelperImpl.java:698) at org.sakaiproject.portal.charon.site.AbstractSiteViewImpl.<init>(AbstractSiteViewImpl.java:99) at org.sakaiproject.portal.charon.site.SubSiteViewImpl.<init>(SubSiteViewImpl.java:58) at org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSitesView(PortalSiteHelperImpl.java:1135) at org.sakaiproject.portal.charon.SkinnableCharonPortal.includeSubSites(SkinnableCharonPortal.java:415) at org.sakaiproject.portal.charon.handlers.SiteHandler.doSite(SiteHandler.java:263) at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:125) at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:627) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:581) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:662) "

    Sakai JIRA | 5 years ago | Zhen Qian
    java.sql.SQLException: Already closed.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    MySQL Connection Timeout Issue - Grails Application on Tomcat using Hibernate and ORM

    Stack Overflow | 7 years ago | gav
    org.hibernate.exception.GenericJDBCException: Cannot release connection
  5. 0

    MySQL Connection Timeout Problem - Grails Application on Tomcat using Hibernate and ORM

    codeblow.com | 1 year ago
    java.sql.SQLException: Already closed.
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.sql.SQLException

    Already closed.

    at org.apache.commons.dbcp.PoolableConnection.close()
  2. Commons DBCP
    PoolingDataSource$PoolGuardConnectionWrapper.close
    1. org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84)
    2. org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
    2 frames
  3. org.sakaiproject.db
    BasicSqlService.dbRead
    1. org.sakaiproject.db.impl.BasicSqlService.returnConnection(BasicSqlService.java:276)
    2. org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:620)
    2 frames
  4. Sakai Component Manager
    BaseDbFlatStorage.getResource
    1. org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:340)
    2. org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:320)
    2 frames
  5. org.sakaiproject.site
    BaseSiteService.getSiteVisit
    1. org.sakaiproject.site.impl.DbSiteService$DbStorage.get(DbSiteService.java:237)
    2. org.sakaiproject.site.impl.BaseSiteService.getDefinedSite(BaseSiteService.java:586)
    3. org.sakaiproject.site.impl.BaseSiteService.getSite(BaseSiteService.java:672)
    4. org.sakaiproject.site.impl.BaseSiteService.getSiteVisit(BaseSiteService.java:750)
    4 frames
  6. Sakai Kernel API
    SiteService.getSiteVisit
    1. org.sakaiproject.site.cover.SiteService.getSiteVisit(SiteService.java:134)
    1 frame
  7. sakai-portal-impl
    SkinnableCharonPortal.doGet
    1. org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSiteVisit(PortalSiteHelperImpl.java:896)
    2. org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getMyWorkspace(PortalSiteHelperImpl.java:698)
    3. org.sakaiproject.portal.charon.site.AbstractSiteViewImpl.<init>(AbstractSiteViewImpl.java:99)
    4. org.sakaiproject.portal.charon.site.SubSiteViewImpl.<init>(SubSiteViewImpl.java:58)
    5. org.sakaiproject.portal.charon.site.PortalSiteHelperImpl.getSitesView(PortalSiteHelperImpl.java:1135)
    6. org.sakaiproject.portal.charon.SkinnableCharonPortal.includeSubSites(SkinnableCharonPortal.java:415)
    7. org.sakaiproject.portal.charon.handlers.SiteHandler.doSite(SiteHandler.java:263)
    8. org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:125)
    9. org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:837)
    9 frames
  8. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    2 frames
  9. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    2 frames
  10. Sakai Component Manager
    RequestFilter.doFilter
    1. org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:658)
    1 frame
  11. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    7. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:581)
    8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    9. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    9 frames
  12. Embedded GlassFish Web
    ChannelSocket$SocketConnection.runIt
    1. org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
    2. org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
    3. org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775)
    4. org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704)
    5. org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
    5 frames
  13. Tomcat Util
    ThreadPool$ControlRunnable.run
    1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    1 frame
  14. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:662)
    1 frame