Re: DBCP: Threads sitting forever in getConnection()?
You should set the maxWait parameter. On Sun, Mar 16, 2008 at 5:29 PM, rohitmp [EMAIL PROTECTED] wrote: HI All, I too am facing the same issue. But in contrast i have my resource setup in context.xml only But still tomcat is waiting indefinitely to to get a connection. My context file is as below ?xml version=1.0 encoding=UTF-8? Context path=/mycontextpath Resource name=jdbc/connPool auth=Container type=javax.sql.DataSource username=schot password=tiger driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost:3306/myDb maxActive=100 maxIdle=30/ /Context the relevant thread dump is as follows http-8080-Processor2 daemon prio=10 tid=0x08374800 nid=0xef4 in Object.wait() [0xae069000..0xae069e30] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on 0xaf619100 (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool) at java.lang.Object.wait(Object.java:485) at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject (GenericObjectPool.java:810) - locked 0xaf619100 (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection (PoolingDataSource.java:96) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection (BasicDataSource.java:880) at com.bhagin.vaanee.util.DBConnection.init (DBConnection.java:64) at com.bhagin.vaanee.authorisation.AttributeBeanSetter.fngetSessionAttributeBean (AttributeBeanSetter.java:42) at org.apache.jsp.authorize_jsp._jspService (authorize_jsp.java:116) 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:331) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:329) 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 (ApplicationFilterChain.java:269) 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:174) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke( ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler. processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket (PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt (LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run (ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Bernardo Cattapan [EMAIL PROTECTED]
Re: tomcat hangs when connetion pooling used
Probably you are not closing connections somewhere and the maxWait property of DBCP is not set. The default is to wait indefinitely. So the tomcat is not hang, it's just waiting for a connection, but all of them are used at the moment and it keeps waiting. I believe that if you set a maxWait parameter on your datasource configuration, you will receive a timeout error or something like this. Try to find where you are not closing the connections. Always close connections on 'finally' statements of a 'try/catch/finally' structure. Att, -- Bernardo Cattapan [EMAIL PROTECTED] On Sun, Mar 16, 2008 at 9:50 AM, ib solution [EMAIL PROTECTED] wrote: hai, is there any an error page that you can share ?, i am using Mysql 5.0.22 and tomcat 5.5.17 and i am always get a connection -- Salam, Andy Susanto,S.Kom == for better search http://www.slashmysearch.com/earn/id/24828 HP : 081513039998 On Sun, Mar 16, 2008 at 4:54 PM, Mahesh Viraktamath [EMAIL PROTECTED] wrote: Hi, I am using connection pooling for all the database transactions. I am using the following: MySql: 5.0.22 tomcat : 5.5.X Now the problem is when I run the application, it can't get the connnection from the connection pool. I tried everything like dumping all the waiting threads, killing all the tomcat processes but nothing seems to work. I can't revert back the results. I want to run the application as I was before. Any suggestions for closing all the connections (if open at all) or anything else so that I can run mu application as earlier. Thanks in advance, Mahesh - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]