• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get Exception :Cannot get a connection, pool error Timeout waiting for idle object

 
Lalit Tomar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Stack Trace :
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at com.DB.db.getConnection(db.java:41)
at com.VL01N.RunnableThread.run(RunnableThread.java:60)
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(GenericObjectPool.java:1134)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
... 4 more
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you getting the database connection?

Are you running this on an application server like Tomcat or console app? How is the data source/connection pool set up (please show XML)?
 
Lalit Tomar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have shown you xml upper.....i run from tocmat?
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the initial size or min pool size of the connection pool? I recall most of these configurations the default should be zero.
 
Lalit Tomar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't give any pool size .
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lalit Tomar wrote:I didn't give any pool size .


How many threads are you launching?
Are each of those threads closing the connections they get?

Add some debug logging (even simple System.out.println() calls), probably in the com.DB.db.getConnection and the com.VL01N.RunnableThread.run methods to track the grabbing of connections, and wherever you hand those connections back.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic