Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AbandonedObjectPool failed on borrowObject: null

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can anyone help me on this one? I've been struggled long to configure Tomcat for database pooling (to Oracle) using DBCP... And finally this is the error I got:

DBCP borrowObject failed: null
at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(
at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(
at org.apache.commons.dbcp.PoolingDataSource.getConnection(
at org.apache.commons.dbcp.BasicDataSource.getConnection(

Here's the code of how I got the DataSource and Connection:

Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env");
DataSource dbSource = (DataSource) envContext.lookup("jdbc/oracle");
Connection con = dbSource.getConnection();

Tomcat did get the datasource back, but failed at the get connection line. What's wrong? I followed the instructions on Apache website on how to configure Database pool using DBCP... I tried to follow the example code in DBCP website to manually configure the database pool and it succeeded without any problem. So my system setup shouldn't have any problem... Can any one give me any idea of what's wrong here? Any feedback is highly appreaciated! I really want to know why Tomcat can not initialze the Database pool successfully!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic