Tomcat6 - Connection has already been closed -
since few days, seeing error 'connection has been closed' in production environment:
following datasource configuration:
<resource defaultautocommit="true" defaultreadonly="false" driverclassname="oracle.jdbc.oracledriver" factory="org.apache.tomcat.jdbc.pool.datasourcefactory" fairqueue="false" initialsize="10" jdbcinterceptors="connectionstate" jmxenabled="true" logabandoned="true" maxactive="100" maxidle="50" maxwait="30000" minevictableidletimemillis="5000" minidle="10" name="jdbc/oracleapps" password="apps" removeabandoned="false" removeabandonedtimeout="60" testonborrow="true" testonreturn="false" suspecttimeout="60" testwhileidle="true" timebetweenevictionrunsmillis="5000" type="javax.sql.datasource" url="jdbcurl" useequals="false" username="apps" validationinterval="30000" validationquery="select 2+2 dual"/>
i have tried configuration various ways still throws same error. idea appreciated:
java.sql.sqlexception: connection has been closed. @ org.apache.tomcat.jdbc.pool.proxyconnection.invoke(proxyconnection.java:118) @ org.apache.tomcat.jdbc.pool.jdbcinterceptor.invoke(jdbcinterceptor.java:94) @ org.apache.tomcat.jdbc.pool.interceptor.connectionstate.invoke(connectionstate.java:140) @ $proxy0.createstatement(unknown source) @ cx.pooleddataconnection.open(unknown source) @ cx.crm.opportunity.opportunityhome.getopportunity(unknown source) @ cx.crm.opportunity.opportunityhome.getopportunitybyprimarykey(unknown source) @ org.apache.jsp.jsp.wow.convertquote_jsp._jspservice(convertquote_jsp.java:559) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:386) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:313) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:260) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ cx.filter.orginalurlfilter.dofilter(unknown source) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ cx.appblockerfilter.dofilter(unknown source) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:563) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:298) @ org.apache.coyote.ajp.ajpprocessor.process(ajpprocessor.java:446) @ org.apache.coyote.ajp.ajpprotocol$ajpconnectionhandler.process(ajpprotocol.java:372) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:409) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:662)
in case happened when there many open connections in pool , in methods called con.close() more once. in finally(s) had following code.
{ try { if (con != null) { con.close(); } } catch (sqlexception e) {} }
this doesn't guarantee connection not closing.
also tomcat-jdbc.jar version old. replaced versión 7.0.55 latest available versión jdk 1.6 , works fine calling close method serveral times.
Comments
Post a Comment