• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Could not create a validated object, cause: ValidateObject failed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a application connecting to oracle database running fine in tomcat server. When we add a third party library to the env, we see that the application is unable to get a connection from pool. It fails with this exception :


Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Could not create a validated object, cause: ValidateObject failed
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
at com.approuter.module.database.protocol.ConnectionManager.getConnection(ConnectionManager.java:154)
... 26 more
Caused by: java.util.NoSuchElementException: Could not create a validated object, cause: ValidateObject failed
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1008)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
... 27 more

The validate query works fine on the oracle database. Any idea on we are seeing ValidateObject failed ?
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No idea. What is "the env" and what are you adding to it?
 
Rohini Tn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have another application which connects to progress database and needs this thrid party jar openedge.jar in the lib folder.
As soon as I add this jar or deploy the second application, this first oracle application fails to get a connection from connection pool with that exception stack. Any idea?
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one Tomcat server whose TOMCAT_HOME/lib directory contains a driver DB2 jar(s), a MySQL/MariaDB driver jar and a PostgreSQL driver jar. I also have run servers with the Oracle drivers in them.

There is no problem.

I think you need to post your database connection pool definition.
 
Rohini Tn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my Connection pooling configuration :

GenericObjectPool connectionPool = new GenericObjectPool();


connectionPool.setMaxActive(25);
connectionPool.setMaxIdle(1);
connectionPool.setMinEvictableIdleTimeMillis(2*1000);
connectionPool.setTimeBetweenEvictionRunsMillis(4*1000);
connectionPool.setTestOnReturn(false);
connectionPool.setTestOnBorrow(true);
connectionPool.setTestWhileIdle(false);
GenericKeyedObjectPoolFactory statementPoolFactory = new GenericKeyedObjectPoolFactory(null,-1,GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL,0,1,50);
ConnectionFactory connectionFactory = new DataSourceConnectionFactory(ds);
boolean defaultReadOnly = false;
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool,statementPoolFactory,query,defaultReadOnly,false);

connectionPool.setFactory(poolableConnectionFactory);
pds.setPool(connectionPool);
pds.setAccessToUnderlyingConnectionAllowed(true);


conn = pds.getConnection();


Please let me know a way to find out why the connection validation is failing here with these configuration. Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not normally be creating a Connection pool in application code. J2EE supports externally-supplied Connection pools. They are:

1. A lot more flexible. If the pool manager you are using isn't optimal, you can swap out for another pool manager that's more appropriate without modifying the application

2. Sharable. You can share the pool with multiple apps, if you like, which can reduce overall system resource requirements.

3. Portable. You don't have to include a vendor-specific database driver as part of the WAR. Instead, your database driver(s) are installed in the Tomcat library directory. This also means that if the driver is upgraded, you don't have to build a whole new WAR.

Tomcat connection pools are constructed from XML specifications. Often the pool is defined for one specific application, so the definition would be in a Tomcat Context definition.

 
reply
    Bookmark Topic Watch Topic
  • New Topic