CachedConnectionStrategy throwing java.lang.NullPointerException

Bug #950679 reported by Dharmarajan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BoneCP
Confirmed
Undecided
Unassigned

Bug Description

I am trying to use the Cached connection strategy in my app running inside quartz scheduler.

Here is my configurations to BoneCp

BoneCPConfig config = new BoneCPConfig();
//.....
config.setPoolStrategy("CACHED");

My app is thowing the following exception

java.lang.NullPointerException
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
at oracle.jdbc.driver.PhysicalConnection.setAutoCommit(PhysicalConnection.java:3229)
at com.jolbox.bonecp.ConnectionHandle.setAutoCommit(ConnectionHandle.java:1316)
at com.xyz.report.utilities.ConnectionPool.getConnection(ConnectionPool.java:216)

Here is my connection pool utility code to obtain connection from BoneCp

public Connection getConnection(boolean autoCommit)
{
Connection connection = connectionPool.getConnection();
connection.setAutoCommit(autoCommit)
return connection;
}

i just modified my code to check my connection object is null or not

Connection connection = connectionPool.getConnection();
log.info("ConnectionPool.getConnection() - connection: "+connection);
ConnectionHandle handle = (ConnectionHandle)connection;
Connection con = handle.getInternalConnection();
log.info("ConnectionPool.getConnection() - internal connection: "+con);

and the results are,

ConnectionPool.getConnection() - connection: com.jolbox.bonecp.ConnectionHandle
ConnectionPool.getConnection() - internal connection: null

So it is clear that, the internal connection wrapped into ConnectionHandle is null and the operation connection.setAutoCommit(autoCommit) is throwing java.lang.NullPointerException

Thanks

Revision history for this message
Wallace Wadge (wwadge) wrote :

Confirmed, but please note it's marked as very experimental at this stage.

Changed in bonecp:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.