Re: Cayenne Supported DBCP Properties

From: Joe Baldwin (jfbaldwi..arthlink.net)
Date: Thu May 27 2010 - 14:04:58 UTC

  • Next message: Andrus Adamchik: "Re: Cayenne Supported DBCP Properties"

    Andrus,

    thanks for the "testWhileIdle" suggestion. This appears to cooperate with validationQuery and allow a startup. (I am also hopeful that it addresses a long standing problem with MySQL connections.)

    However, it appears that there is a repeatable problem with testOnBorrow & validationQuery (i.e. Tomcat throws an exception on startup and the app fails to start). Is it possible that there is a bug with these two parameters?

    Thanks
    Joe

    On May 27, 2010, at 4:32 AM, Andrus Adamchik wrote:

    > Actually reading on this some more:
    >
    > http://www.sqlpower.ca/forum/posts/list/1711.page
    >
    > Maybe you need to set "testOnBorrow" to false? Personally I never use this parameter at all. Instead I am using "testWhileIdle" and "validationQuery" and the pool still stays fresh.
    >
    > Andrus
    >
    > On May 27, 2010, at 11:26 AM, Andrus Adamchik wrote:
    >
    >> Is there a deeper stack trace? Could it be that the specific validation query is failing or the pool can't establish a connection or something?
    >>
    >> Andrus
    >>
    >>
    >> On May 27, 2010, at 11:15 AM, Joe Baldwin wrote:
    >>
    >>> I asked this question previously but got no response. The problem appears to be with Cayenne supported DBCP properties.
    >>>
    >>> My webapp is getting the following exception (Cayenne 3.0, with dbcpdatasourcefactory):
    >>>
    >>> java.util.NoSuchElementException: Could not create a validated object, cause: ValidateObject failed
    >>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1191)
    >>>
    >>> When the following two parameters are added to the dbcp.properties file
    >>>
    >>> cayenne.dbcp.validationQuery="select 1"
    >>> cayenne.dbcp.testOnBorrow=true
    >>>
    >>> (Note: This does not occur if the two parameters are left out.)
    >>>
    >>> My understanding from the Apache DBCP docs is that the "testOnBorrow" will not be run if the "validationQuery" parameter is not set, and therefore they must both be set for this "testOnBorrow" validation to occur.
    >>>
    >>> Furthermore, the cayenne docs
    >>>
    >>> http://cayenne.apache.org/doc30/dbcpdatasourcefactory.html
    >>>
    >>> list these two parameters as supported by Cayenne dbcpDataSourceFactory.
    >>>
    >>> Questions:
    >>> 1. Are these parameters actually supported as I understand them, and if so, then has anyone seen this exception?
    >>> 2. What is the default connection-validation behavior when these parameters are absent from the configuration?
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu May 27 2010 - 14:05:30 UTC