> -----Original Message-----
> From: Romain Manni-Bucau [mailto:[email protected]]
> Sent: Thursday, January 19, 2017 12:53 AM
> To: [email protected]
> Subject: Re: How do deal with occasional "Failed to validate a newly
> established connection."
>
> Hi
>
> maybe try setting LogValidationErrors to true or activate debug log, you
> will see the cause
Ok, this is what I see after turning on LogValidationErrors. The trace is
pruned to the first entry in my code:
---------------------
Jan 19, 2017 8:18:50 AM org.apache.tomcat.jdbc.pool.PooledConnection validate
WARNING: SQL Validation error
java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:973)
at
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1041)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at
oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at
oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at
org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:509)
at
org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:443)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:783)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132)
at
org.apache.openejb.resource.jdbc.managed.local.ManagedConnection.newConnection(ManagedConnection.java:180)
at
org.apache.openejb.resource.jdbc.managed.local.ManagedConnection.invoke(ManagedConnection.java:109)
at com.sun.proxy.$Proxy71.createStatement(Unknown Source)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:402)
at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474)
at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484)
at
com.att.detsusl.uslMonitorService.dao.USLTransactionInfoDAO.getErrorCountsEntries(USLTransactionInfoDAO.java:156)
Jan 19, 2017 8:18:50 AM org.apache.tomcat.jdbc.pool.PooledConnection validate
WARNING: SQL Validation error
java.sql.SQLException: Invalid SQL type: sqlKind = UNINITIALIZED
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:63)
at
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at
oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at
oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at
org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:509)
at
org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:443)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:807)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132)
at
org.apache.openejb.resource.jdbc.managed.local.ManagedConnection.newConnection(ManagedConnection.java:180)
at
org.apache.openejb.resource.jdbc.managed.local.ManagedConnection.invoke(ManagedConnection.java:109)
at com.sun.proxy.$Proxy71.createStatement(Unknown Source)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:402)
at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474)
at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484)
at
com.att.detsusl.uslMonitorService.dao.USLTransactionInfoDAO.getErrorCountsEntries(USLTransactionInfoDAO.java:156)
----------------------
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-
> rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> |
> Github <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-01-19 2:01 GMT+01:00 KARR, DAVID <[email protected]>:
>
> > I've got a small app running in Tomee. It runs a couple of Oracle db
> > queries every two minutes. I'm getting errors like this every once in
> > a
> > while:
> > ---------------
> > Caused by: java.sql.SQLException: Failed to validate a newly
> > established connection.
> > at
> > org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(
> > ConnectionPool.java:822)
> > at
> > org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(
> > ConnectionPool.java:633)
> > at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(
> > ConnectionPool.java:187)
> > at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(
> > DataSourceProxy.java:132)
> > at org.apache.openejb.resource.jdbc.managed.local.
> > ManagedConnection.newConnection(ManagedConnection.java:180)
> > at org.apache.openejb.resource.jdbc.managed.local.
> > ManagedConnection.invoke(ManagedConnection.java:109)
> > at com.sun.proxy.$Proxy73.createStatement(Unknown Source)
> > at org.springframework.jdbc.core.JdbcTemplate.execute(
> > JdbcTemplate.java:402)
> > ... 51 more
> > ------------------
> >
> > The datasource in tomee.xml is defined like this:
> > --------
> > <Resource id="tst36" type="DataSource">
> > testOnBorrow = true
> > testOnReturn = true
> > testWhileIdle = true
> > validationQuery = "select 1 from dual"
> > JdbcDriver = oracle.jdbc.OracleDriver
> > MaxActive = 10
> > MinIdle = 2
> > MaxIdle = 2
> > MaxWait = 10000
> > JdbcUrl = jdbc:oracle:thin:...
> > UserName = ...
> > Password = ...
> > </Resource>
> > ------------
> >
> > Can I tweak these settings to avoid that error?
> >