You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Alexei Samonov (JIRA)" <ji...@apache.org> on 2007/05/24 19:08:18 UTC

[jira] Updated: (DBCP-225) getConnection / borrowObject fails with NullPointerException

     [ https://issues.apache.org/jira/browse/DBCP-225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Samonov updated DBCP-225:
--------------------------------

    Description: 
We use dbcp PoolingDataSource in Solaris/Oracle 10g RAC environment and our getConnection calls fail sporadically with the following stack trace (1.2.1)

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        ... more
Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:806)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
        ... 24 more

This is definitely not a "pool exhausted" situation, it is just being reported as pool exhausted. Since NoSuchElementException that you use does not allow cause, only Exception message (null) is being printed. With some debugging I was able to recover the root exception:

java.lang.NullPointerException
    at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:268)
    at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java:368)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:786)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
...

Looks like it is trying to borrow/validate DelegatingConnection which delegate is null.



Hoping to resolve the issue we upgraded to 1.2.2 but it did not help. Here is is an exception stack trace from 1.2.2:

org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Could not create a validated object, cause: null
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
        ... more
Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:871)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
        ... 28 more


We use the following dbcp properties:

autoCommit="false"
readOnly="false"
maxActive="200"
maxIdle="20"
minIdle="10"
minEvictableIdleIime="300000"
maxWait="200"
accessToUnderlyingConnectionAllowed="true"
validationQuery="SELECT 1 FROM DUAL"
ConnectionCachingEnabled="true"
FastConnectionFailoverEnabled="true"



I could not find the existing reported dbcp/object pool bug but I see similar  reports on the web, for example 
http://forum.java.sun.com/thread.jspa?threadID=713200&messageID=4124915

  was:
We use dbcp PoolingDataSource in Solaris/Oracle 10g RAC environment and our getConnection calls fail sporadically with the following stack trace (1.2.1)

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        ... more
Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:806)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
        ... 24 more

This is definitely not a "pool exhausted" situation, it is just being reported as pool exhausted. Since NoSuchElementException that you use does not allow cause, only Exception message (null) is being printed. With some debugging I was able to recover the root exception:

java.lang.NullPointerException
    at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:268)
    at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java:368)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:786)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
...

Looks like it is trying to borrow/validate DelegatingConnection which delegate is null.



Hoping to resolve the issue we upgraded to 1.2.2 but it did not help. Here is is an exception stack trace from 1.2.2:

org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Could not create a validated object, cause: null
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
        ... more
Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:871)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
        ... 28 more


We use the following dbcp properties:

autoCommit="false"
readOnly="false"
maxActive="200"
maxIdle="20"
minIdle="10"
minEvictableIdleIime="300000"
maxWait="200"
accessToUnderlyingConnectionAllowed="true"
validationQuery="SELECT 1 FROM DUAL"

I could not find the existing reported dbcp/object pool bug but I see similar  reports on the web, for example 
http://forum.java.sun.com/thread.jspa?threadID=713200&messageID=4124915


> getConnection / borrowObject fails with NullPointerException
> ------------------------------------------------------------
>
>                 Key: DBCP-225
>                 URL: https://issues.apache.org/jira/browse/DBCP-225
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.2.1, 1.2.2
>         Environment: Solaris 10, Oracle 10g RAC
>            Reporter: Alexei Samonov
>
> We use dbcp PoolingDataSource in Solaris/Oracle 10g RAC environment and our getConnection calls fail sporadically with the following stack trace (1.2.1)
> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
>         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
>         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
>         ... more
> Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
>         at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:806)
>         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
>         ... 24 more
> This is definitely not a "pool exhausted" situation, it is just being reported as pool exhausted. Since NoSuchElementException that you use does not allow cause, only Exception message (null) is being printed. With some debugging I was able to recover the root exception:
> java.lang.NullPointerException
>     at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:268)
>     at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java:368)
>     at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:786)
>     at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
>     at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
> ...
> Looks like it is trying to borrow/validate DelegatingConnection which delegate is null.
> Hoping to resolve the issue we upgraded to 1.2.2 but it did not help. Here is is an exception stack trace from 1.2.2:
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Could not create a validated object, cause: null
>         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
>         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
>         ... more
> Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: null
>         at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:871)
>         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
>         ... 28 more
> We use the following dbcp properties:
> autoCommit="false"
> readOnly="false"
> maxActive="200"
> maxIdle="20"
> minIdle="10"
> minEvictableIdleIime="300000"
> maxWait="200"
> accessToUnderlyingConnectionAllowed="true"
> validationQuery="SELECT 1 FROM DUAL"
> ConnectionCachingEnabled="true"
> FastConnectionFailoverEnabled="true"
> I could not find the existing reported dbcp/object pool bug but I see similar  reports on the web, for example 
> http://forum.java.sun.com/thread.jspa?threadID=713200&messageID=4124915

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org