Grokbase Groups Cayenne user May 2010
FAQ
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?

Search Discussions

  • Andrus Adamchik at May 27, 2010 at 8:27 am
    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?
  • Andrus Adamchik at May 27, 2010 at 8:33 am
    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?
  • Joe Baldwin at May 27, 2010 at 2:05 pm
    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?
  • Andrus Adamchik at May 27, 2010 at 2:24 pm

    On May 27, 2010, at 5:04 PM, Joe Baldwin wrote:

    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.)
    So if it works, don't fix it :-)
    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?
    The link that I googled and mentioned in my previous email suggests
    that there is - in commons-pool or commons-dbcp. You may try to follow
    up with the Apache Commons folks if you want to dig deeper.

    Andrus
  • Joe Baldwin at May 27, 2010 at 4:17 pm
    Andrus,

    Thanks again for your suggestion. It *appears* to have revealed another possibly associated problem.

    I have been working on a "load time" problem that has the symptoms of causing a jsp page using Cayenne (connecting to MySQL 5.0.x) taking about 30-60 secs to load. With the help of the Cayenne team it appears that it was not due to Cayenne. However, the webhost tech person believes that it cannot be MySQL 5.0.x.

    Well almost immediately after getting the "testWhileIdle" configuration working I got another load-event with the corresponding Catalina log exception:

    java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

    I did some more research and the web-comments (while not conclusive) appear to point to the InnoDB table locking issue that I found documented in some MySQL 5.0.x bug reports.

    Question:
    Since I cannot reproduce this error on my development machine (and my head is about to explode on this one :) ), do you think that there a chance that this is in the DBCP Pool Manager (that I have just configured for Cayenne), or is it more likely that it is MySQL 5.0.x InnoDB?

    (My only test left is to request that they move the project to a new server with MySQL 5.1.x)

    Thanks for all your help so far,
    Joe







    On May 27, 2010, at 10:23 AM, Andrus Adamchik wrote:

    On May 27, 2010, at 5:04 PM, Joe Baldwin wrote:

    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.)
    So if it works, don't fix it :-)
    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?
    The link that I googled and mentioned in my previous email suggests that there is - in commons-pool or commons-dbcp. You may try to follow up with the Apache Commons folks if you want to dig deeper.

    Andrus
  • Joe Baldwin at May 27, 2010 at 4:20 pm
    Almost forgot: the MySQL logs appear to show numerous "rollbacks" (that are definitely not initiated by my code or by Cayenne). What appears to be suspicious is that some developers have been reporting "rollbacks" associated with the InnoDB locking issue.

    On May 27, 2010, at 12:16 PM, Joe Baldwin wrote:

    Andrus,

    Thanks again for your suggestion. It *appears* to have revealed another possibly associated problem.

    I have been working on a "load time" problem that has the symptoms of causing a jsp page using Cayenne (connecting to MySQL 5.0.x) taking about 30-60 secs to load. With the help of the Cayenne team it appears that it was not due to Cayenne. However, the webhost tech person believes that it cannot be MySQL 5.0.x.

    Well almost immediately after getting the "testWhileIdle" configuration working I got another load-event with the corresponding Catalina log exception:

    java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

    I did some more research and the web-comments (while not conclusive) appear to point to the InnoDB table locking issue that I found documented in some MySQL 5.0.x bug reports.

    Question:
    Since I cannot reproduce this error on my development machine (and my head is about to explode on this one :) ), do you think that there a chance that this is in the DBCP Pool Manager (that I have just configured for Cayenne), or is it more likely that it is MySQL 5.0.x InnoDB?

    (My only test left is to request that they move the project to a new server with MySQL 5.1.x)

    Thanks for all your help so far,
    Joe







    On May 27, 2010, at 10:23 AM, Andrus Adamchik wrote:

    On May 27, 2010, at 5:04 PM, Joe Baldwin wrote:

    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.)
    So if it works, don't fix it :-)
    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?
    The link that I googled and mentioned in my previous email suggests that there is - in commons-pool or commons-dbcp. You may try to follow up with the Apache Commons folks if you want to dig deeper.

    Andrus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMay 27, '10 at 8:16a
activeMay 27, '10 at 4:20p
posts7
users2
websitecayenne.apache.org

2 users in discussion

Joe Baldwin: 4 posts Andrus Adamchik: 3 posts

People

Translate

site design / logo © 2022 Grokbase