cannot get connection, pool exhausted
534835Feb 23 2008 — edited Jan 14 2015 org.apache.tomcat.dbcp.dbcp.SQLNestedException: cannot get connection, pool exhausted.
i have configured connection pooling in tomcat in the context.xml file.
i have created a class with static method which will return the connection object from the datasource.
Iam using this connection object every time for database transactions.
At some time iam geeting this error..
org.apache.tomcat.dbcp.dbcp.SQLNestedException: cannot get connection, pool exhausted.
here are the configuration settings.....
<Resource
name="jdbc/pool"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="scott"
password="tiger"
driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:odbc:pool"
maxWait="1000"
removeAbandoned="true"
maxActive="130"
maxIdle="10"
removeAbandonedTimeout="300"
logAbandoned="true"
/>
Database used : Oracle 9i
driver: jdbc odbc driver (type 1)
Server: tomcat 5.5
can any one tell me how to solve this problem...if i increase the maxinActive="" attribute value to 140 iam getting the following error..
java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00020: maximum number of processes (150) exceeded...
how to over come this problem....?
here is the stack trace for the first problem pool exhausted...
-----------------------------------------------------------------------
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool ex
hausted
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDa
taSource.java:103)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSo
urce.java:540)
at rollno.Connect.getConnection(Connect.java:30)
at org.apache.jsp.admnin_jspService(admnin_jsp.java:7
8)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
15)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:301)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.j
ava:691)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.jav
a:661)
at org.apache.jsp.login_jspService(login_jsp.java:193)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
15)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:685)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(Gener
icObjectPool.java:756)
at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(Abandone
dObjectPool.java:74)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDa
taSource.java:95)
------------------------------------------------------------
thanks in advance